GNOME Bugzilla – Bug 435853
abstract class methods
Last modified: 2008-10-25 07:07:44 UTC
Please describe the problem: I tried to declare a virtual method in an abstract class as abstract, but the C code failed to compile (since the real_ function was not declared). Omitting the abstract keyword declared the real_ function but did not define it. My thoughts are that a non-abstract, plain 'virtual' should either require that the method have a body or assume it is abstract. An 'abstract virtual' should not have a real_ function at all (ie not try to give a function pointer in the class initializer). Steps to reproduce: 1. Make a class with a method declared as "abstract virtual" 2. Try to compile the generated C code 3. Actual results: Error that the real_ function pointer does not exist. Expected results: The class initializer should not reference the non-existent real_ function. Does this happen every time? Yes Other information:
Abstract methods should just be declared as `abstract`, i.e. without specifying the `virtual` modifier. The compiler should report an error when specifying both modifiers, I've fixed that in SVN trunk.
test-case added in vala-tests. Seems to not work as you said Jurg. Could you check?
2008-10-25 Jürg Billeter <j@bitron.ch> * vala/valaparser.vala: Report error when using conflicting method modifiers, fixes bug 535853 Fixed in r1912.