[Bug 305460]
lichray
305460 at bugs.launchpad.net
Sun Feb 23 02:56:46 UTC 2020
The example in this bug is not as severe and frequent as the one in bug
44841. Users are more likely to encounter this issue when adding a new
API to existing interface or type erasure.
Calling this a "well-known issue" is irresponsible. The issue
significantly increases the bar to learners to consume and accept new
paradigms in the language.
The issue has not been fixed for ten years. It is a shame rather than
some arcane knowledge that worth to be proud of.
MSVC has no such issue. The error message reads as "undefined reference
to Class::that_virtual_function."
Some possible fixes:
1. Adjust the error message to say, "The first non-inline, non-pure function may not have a definition in <Class>."
2. Add extra information to name the key function, and pass it to the linker, generate an error message to match MSVC's quality.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/305460
Title:
[PR42540] c++ error message [vtable undefined] is unhelpful
Status in gcc:
In Progress
Status in gcc-defaults package in Ubuntu:
Confirmed
Bug description:
I've had response to g++ crash reports, so maybe you'd also like to
know about this confusing error message I found.
Thanks!
Alan
This is on an up-to-date install of "Ubuntu 8.04.1".
apt-cache policy gcc
gcc:
Installed: 4:4.2.3-1ubuntu6
Candidate: 4:4.2.3-1ubuntu6
Version table:
*** 4:4.2.3-1ubuntu6 0
500 http://gb.archive.ubuntu.com hardy-updates/main Packages
100 /var/lib/dpkg/status
4:4.2.3-1ubuntu3 0
500 http://gb.archive.ubuntu.com hardy/main Packages
Minimal test program:
class A {
A();
virtual void B();
};
A::A() {}
/* Whoops, I forgot to define A::B() */
Actual error message:
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/cc8P2uDq.o: In function `A::A()':
test.cpp:(.text+0x9): undefined reference to `vtable for A'
/tmp/cc8P2uDq.o: In function `A::A()':
test.cpp:(.text+0x1f): undefined reference to `vtable for A'
collect2: ld returned 1 exit status
Expected error message:
Something more like "undefined reference to A::B()"
To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions
More information about the foundations-bugs
mailing list