[Bug other/42540] c++ error message [vtable undefined] is unhelpful

rearnsha at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Feb 24 14:17:00 GMT 2010



------- Comment #5 from rearnsha at gcc dot gnu dot org  2010-02-24 14:17 -------
As suggested, there's no bug in the compiler here, and the error message comes
from the linker.  The linker doesn't know what the key function is, so I doubt
it could issue a more accurate diagnostic.

In fact, the key function is just a trigger to the compiler to cause it to emit
the meta-data for the class exactly once -- and because there the class could
be used in multiple compilation units it can never know which one should
contain the meta data as any of them could have done.  As far as the linker is
concerned, there really is no class for A; it's the same as if there was no
definition for a global extern variable.


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42540



More information about the Gcc-bugs mailing list