Launchpad has imported 11 comments from the remote bug at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42540.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2009-12-29T14:44:24+00:00 Debian GCC maintainers wrote:

class A {
    A();

    virtual void B();
};

A::A() {}
/* Whoops, I forgot to define A::B() */

$ g++ -Wall a.cc 
/usr/lib/../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccaVlePI.o: In function `A::A()':
a.cc:(.text+0xf): undefined reference to `vtable for A'
collect2: ld returned 1 exit status

bug submitter writes:
"To be clear: the problem is that the error message only mentions the 
constructor, and the vtable. It doesn't mention the method A::B(), which is 
actually the problem. On a less-minimal example it could take much longer to 
work out what the real problem is."

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/2

------------------------------------------------------------------------
On 2009-12-29T15:05:46+00:00 Pinskia wrote:

I don't know if there is anything there could be done here since the
linker is what is producing the error.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/3

------------------------------------------------------------------------
On 2009-12-29T19:26:52+00:00 Pinskia wrote:

In fact it depends on the key function being declared which depends on
the ABI really (ARM EABI has a slightly different key function than the
rest of the abis).

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/4

------------------------------------------------------------------------
On 2010-01-06T10:42:05+00:00 Jwakely-gcc wrote:

The linker error alone doesn't make the root cause obvious, but it's a fairly 
well known and well documented problem:
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.10

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/5

------------------------------------------------------------------------
On 2010-02-24T13:25:46+00:00 Manu-gcc wrote:

Is it impossible to detect this in the compiler?

Can't we put the vtable somewhere else (or break it in pieces) such
triggering the error in the compiler?

Otherwise, we should just close this as WONTFIX.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/6

------------------------------------------------------------------------
On 2010-02-24T14:17:28+00:00 Rearnsha wrote:

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.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/7

------------------------------------------------------------------------
On 2010-07-06T15:47:39+00:00 Pinskia wrote:

*** Bug 44841 has been marked as a duplicate of this bug. ***

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/8

------------------------------------------------------------------------
On 2010-07-13T22:56:43+00:00 Jeffrey Yasskin wrote:

I'm working on a patch for this at http://gcc.gnu.org/ml/gcc-
patches/2010-07/msg01116.html. It works by emitting a fake use of the
key method any time a translation unit depends on an imported vtable or
typeinfo.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/9

------------------------------------------------------------------------
On 2010-07-13T22:58:07+00:00 Pinskia wrote:

Reopening ....

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/10

------------------------------------------------------------------------
On 2011-03-17T15:39:00+00:00 Manu-gcc wrote:

Pending for 4.7

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/11

------------------------------------------------------------------------
On 2011-03-17T16:16:50+00:00 Jyasskin-gcc wrote:

Mark asked for a different implementation in http://gcc.gnu.org/ml/gcc-
patches/2010-08/msg00367.html, and I may not get a chance to do what he
asked for 4.7. Someone else is welcome to pick this up if they have
time.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/12


** Changed in: gcc
   Importance: Unknown => Wishlist

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to