[Issue 3655] Virtual functions without bodies are not optimized away.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 28 21:14:33 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3655
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla at digitalmars.com
Resolution| |INVALID
--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> 2009-12-28 21:14:32 PST ---
The compiler is working as designed.
The final function is not virtual, so it is never needed in the vtbl[]. Hence,
there is no undefined reference to it in the vtbl[].
The non-final function is virtual, and so a reference to it is put into the
vtbl[]. The function's implementation must exist somewhere, and if it did, the
linker would put a reference to the implementation in the vtbl[]. This feature
allows one to have an implementation that is hidden from the user of the class.
If you truly do not want to implement the function, declare it as 'abstract'.
Then, a NULL is put in the corresponding place in the vtbl[].
Not a bug.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list