After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 435853 - abstract class methods
abstract class methods
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Parser
0.4.x
Other All
: Normal minor
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2007-05-04 15:09 UTC by Michael Lawrence
Modified: 2008-10-25 07:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Lawrence 2007-05-04 15:09:58 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:
Comment 1 Jürg Billeter 2007-05-09 12:01:00 UTC
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.
Comment 2 Marc-Andre Lureau 2008-10-18 17:41:26 UTC
test-case added in vala-tests. Seems to not work as you said Jurg. Could you check?
Comment 3 Jürg Billeter 2008-10-25 07:07:44 UTC
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.