[Bug c++/104918] Pass information to let the linker tell the user which virtual members are missing

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 14 14:20:58 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104918

Jonathan Wakely <redi at gcc dot gnu.org> changed:

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The issue is that the vtable is missing, which is why the linker says so.

If the vtable is present, it does tell you about the missing virtual:
https://godbolt.org/z/zbfvTh74v

/opt/compiler-explorer/gcc-11.2.0/bin/../lib/gcc/x86_64-linux-gnu/11.2.0/../../../../x86_64-linux-gnu/bin/ld:
/tmp/ccI0XFwh.o:(.rodata._ZTV1B[_ZTV1B]+0x18): undefined reference to
`B::foo()'

I don't think there's anything for GCC to do here. Maybe the linker should
print a note after a missing vtable error saying that they key function needs
to be defined, which is already suggested at PR 42540.

See also https://gcc.gnu.org/wiki/VerboseDiagnostics#missing_vtable

*** This bug has been marked as a duplicate of bug 42540 ***


More information about the Gcc-bugs mailing list