public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-17 15:41 ` manu at gcc dot gnu.org
  2011-03-17 16:17 ` jyasskin at gcc dot gnu.org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: manu at gcc dot gnu.org @ 2011-03-17 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |46542

--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-03-17 15:39:00 UTC ---
Pending for 4.7


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
  2011-03-17 15:41 ` [Bug other/42540] c++ error message [vtable undefined] is unhelpful manu at gcc dot gnu.org
@ 2011-03-17 16:17 ` jyasskin at gcc dot gnu.org
  2020-07-22 13:56 ` redi at gcc dot gnu.org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: jyasskin at gcc dot gnu.org @ 2011-03-17 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey Yasskin <jyasskin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jyasskin at gcc dot gnu.org

--- Comment #10 from Jeffrey Yasskin <jyasskin at gcc dot gnu.org> 2011-03-17 16:16:50 UTC ---
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.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
  2011-03-17 15:41 ` [Bug other/42540] c++ error message [vtable undefined] is unhelpful manu at gcc dot gnu.org
  2011-03-17 16:17 ` jyasskin at gcc dot gnu.org
@ 2020-07-22 13:56 ` redi at gcc dot gnu.org
  2020-07-22 13:57 ` redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-22 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Zhihao Yuan from comment #11)
> 1. Adjust the error message to say, "The first non-inline, non-pure function
> may not have a definition in <Class>."

That error comes from the linker. The linker is not part of GCC, so this is the
wrong place to ask for linker changes.

> 2. Add extra information to name the key function, and pass it to the
> linker, generate an error message to match MSVC's quality.

That's what comment 7 suggested. Comment 10 links to the response to that.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-07-22 13:56 ` redi at gcc dot gnu.org
@ 2020-07-22 13:57 ` redi at gcc dot gnu.org
  2020-07-22 13:57 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-22 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> 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

A better link is now:
https://gcc.gnu.org/wiki/VerboseDiagnostics#undefined_reference_to_vtable_for_X

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-07-22 13:57 ` redi at gcc dot gnu.org
@ 2020-07-22 13:57 ` redi at gcc dot gnu.org
  2022-03-14 14:20 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-22 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eyalroz at technion dot ac.il

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 96283 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2020-07-22 13:57 ` redi at gcc dot gnu.org
@ 2022-03-14 14:20 ` redi at gcc dot gnu.org
  2022-03-14 14:38 ` eyalroz1 at gmx dot com
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-14 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 104918 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-03-14 14:20 ` redi at gcc dot gnu.org
@ 2022-03-14 14:38 ` eyalroz1 at gmx dot com
  2022-03-14 17:15 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: eyalroz1 at gmx dot com @ 2022-03-14 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Eyal Rozenberg <eyalroz1 at gmx dot com> ---
Some comments following my recent dupe...

(In reply to Andrew Pinski from comment #1)
> I don't know if there is anything there could be done here since the linker
> is what is producing the error.

The compiler could store information in the compiled object listing the virtual
members for which no implementation was found, due to which reason the vtable
was not defined already. In this specific example, storing the name of "A::B()"
somewhere. If that information is available, we could then petition linker
authors to use it and print the missing virtual members in the error message.

(In reply to  Richard Earnshaw from comment #5)
> As suggested, there's no bug in the compiler here

Not passing sufficient information to the linker is a "bug", or at least - a
missing feature.

(In reply to Zhihao Yuan from comment #11)
> 2. Add extra information to name the key function, and pass it to the linker, generate an error message to match MSVC's quality.

I'm not quite sure what a key function is, but it sounds like my suggestion is
similar to this one. So, I support your suggestion (2.)

> 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.

Not just learners. If you have a large class with many methods, whose
implementation is spread across many files, it can take quite a bit of time to
figure out which method implementation is missing.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-03-14 14:38 ` eyalroz1 at gmx dot com
@ 2022-03-14 17:15 ` redi at gcc dot gnu.org
  2022-03-14 17:22 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-14 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Eyal Rozenberg from comment #16)
> I'm not quite sure what a key function is,

Then read the link I gave you in PR 104918 comment 1.


> Not just learners. If you have a large class with many methods, whose
> implementation is spread across many files, it can take quite a bit of time
> to figure out which method implementation is missing.

The first one. They key function is the first non-inline, non-pure virtual
function. Read the wiki page. I didn't write that page and suggest you read it
just for fun.

The linker could easily say that, with no changes from GCC. That belongs in the
binutils bugzilla though.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-03-14 17:15 ` redi at gcc dot gnu.org
@ 2022-03-14 17:22 ` redi at gcc dot gnu.org
  2022-03-16 20:13 ` eyalroz1 at gmx dot com
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-14 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Eyal Rozenberg from comment #16)
> The compiler could store information in the compiled object listing the
> virtual members for which no implementation was found, due to which reason
> the vtable was not defined already. In this specific example, storing the
> name of "A::B()" somewhere.

In every file that includes the header defining A?

Consider the case where you include the header in ten files, and define the
virtual functions in one of them. Nine out of ten files do not contain a
definitions of the virtual functions, so they would each contain the same info
naming every virtual function in the class. Then do that for every polymorphic
class in every object file. This is a lot more info being written out, and most
of it will never be used.

You have nine files saying "this function is missing" and one not saying it.
What exactly does the linker do with that information? Why would that be better
than comment 7 here?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2022-03-14 17:22 ` redi at gcc dot gnu.org
@ 2022-03-16 20:13 ` eyalroz1 at gmx dot com
  2022-03-16 20:34 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: eyalroz1 at gmx dot com @ 2022-03-16 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Eyal Rozenberg <eyalroz1 at gmx dot com> ---
(In reply to Jonathan Wakely from comment #17)
Ok, have read the wiki page.

> The linker could easily say that, with no changes from GCC.

Is the signature, or name, of the "key function" present in compiled object
files which have seen the class definition?

If the answer is yes, we could just go ahead and file a bug against binutils...

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2022-03-16 20:13 ` eyalroz1 at gmx dot com
@ 2022-03-16 20:34 ` redi at gcc dot gnu.org
  2022-03-16 20:40 ` eyalroz1 at gmx dot com
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-16 20:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No, but "the first non-pure, non-inline virtual function in the class" is easy
for the user to find.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2022-03-16 20:34 ` redi at gcc dot gnu.org
@ 2022-03-16 20:40 ` eyalroz1 at gmx dot com
  2022-07-21 21:29 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: eyalroz1 at gmx dot com @ 2022-03-16 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from Eyal Rozenberg <eyalroz1 at gmx dot com> ---
(In reply to Jonathan Wakely from comment #20)
> No, but "the first non-pure, non-inline virtual function in the class" is
> easy for the user to find.

Well, yes, granted, that would be a huge improvement. But then, is binutils
allowed to make that assumption about the ABI?  ... actually, never mind. Even
if it isn't, they could still write something like "The probable cause is a
lack of definition of the first virtual method in the class which isn't inline
nor pure-virtual".

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2022-03-16 20:40 ` eyalroz1 at gmx dot com
@ 2022-07-21 21:29 ` redi at gcc dot gnu.org
  2022-08-25  9:11 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2022-07-21 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> ---
https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable

The ABI specifies it

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2022-07-21 21:29 ` redi at gcc dot gnu.org
@ 2022-08-25  9:11 ` manu at gcc dot gnu.org
  2022-08-25  9:17 ` manu at gcc dot gnu.org
  2022-08-25  9:28 ` redi at gcc dot gnu.org
  15 siblings, 0 replies; 25+ messages in thread
From: manu at gcc dot gnu.org @ 2022-08-25  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|jyasskin at gmail dot com          |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW
   Last reconfirmed|2010-07-13 22:58:26         |2022-8-25
           Keywords|                            |patch
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2010-08/msg00367.htm
                   |                            |l

--- Comment #23 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Unassigned so that someone else can take it they wish to.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2022-08-25  9:11 ` manu at gcc dot gnu.org
@ 2022-08-25  9:17 ` manu at gcc dot gnu.org
  2022-08-25  9:28 ` redi at gcc dot gnu.org
  15 siblings, 0 replies; 25+ messages in thread
From: manu at gcc dot gnu.org @ 2022-08-25  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
For completeness, this is what LLD says:

ld.lld: error: undefined symbol: vtable for A
>>> referenced by example.cpp:7
>>>               /tmp/example-5d8b98.o:(A::A())
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)

which seems better.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
       [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2022-08-25  9:17 ` manu at gcc dot gnu.org
@ 2022-08-25  9:28 ` redi at gcc dot gnu.org
  15 siblings, 0 replies; 25+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-25  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #25 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, and it 1) refers to the key function and 2) is done by the linker not the
compiler.

Which is what I've been suggesting.

If binutils wants to do this and wants to provide a URL, we'll need a more
permanent home for the info at
https://gcc.gnu.org/wiki/VerboseDiagnostics#undefined_reference_to_vtable_for_X

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
                   ` (7 preceding siblings ...)
  2010-07-13 22:58 ` pinskia at gcc dot gnu dot org
@ 2010-07-13 22:58 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-13 22:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jyasskin at gmail dot com
                   |dot org                     |
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-13 22:58:26
               date|                            |


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
                   ` (6 preceding siblings ...)
  2010-07-13 22:56 ` jyasskin at gmail dot com
@ 2010-07-13 22:58 ` pinskia at gcc dot gnu dot org
  2010-07-13 22:58 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-13 22:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2010-07-13 22:58 -------
Reopening ....


-- 

pinskia at gcc dot gnu dot org changed:

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


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
                   ` (5 preceding siblings ...)
  2010-07-06 15:47 ` pinskia at gcc dot gnu dot org
@ 2010-07-13 22:56 ` jyasskin at gmail dot com
  2010-07-13 22:58 ` pinskia at gcc dot gnu dot org
  2010-07-13 22:58 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 25+ messages in thread
From: jyasskin at gmail dot com @ 2010-07-13 22:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jyasskin at gmail dot com  2010-07-13 22:56 -------
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.


-- 

jyasskin at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jyasskin at gmail dot com


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
                   ` (4 preceding siblings ...)
  2010-02-24 14:17 ` rearnsha at gcc dot gnu dot org
@ 2010-07-06 15:47 ` pinskia at gcc dot gnu dot org
  2010-07-13 22:56 ` jyasskin at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-06 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2010-07-06 15:47 -------
*** Bug 44841 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |phresnel at gmail dot com


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
                   ` (3 preceding siblings ...)
  2010-02-24 13:26 ` manu at gcc dot gnu dot org
@ 2010-02-24 14:17 ` rearnsha at gcc dot gnu dot org
  2010-07-06 15:47 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2010-02-24 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2010-01-06 10:42 ` jwakely dot gcc at gmail dot com
@ 2010-02-24 13:26 ` manu at gcc dot gnu dot org
  2010-02-24 14:17 ` rearnsha at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-24 13:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2010-02-24 13:25 -------
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.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
  2009-12-29 15:06 ` [Bug other/42540] " pinskia at gcc dot gnu dot org
  2009-12-29 19:27 ` pinskia at gcc dot gnu dot org
@ 2010-01-06 10:42 ` jwakely dot gcc at gmail dot com
  2010-02-24 13:26 ` manu at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2010-01-06 10:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jwakely dot gcc at gmail dot com  2010-01-06 10:42 -------
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


-- 


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
  2009-12-29 15:06 ` [Bug other/42540] " pinskia at gcc dot gnu dot org
@ 2009-12-29 19:27 ` pinskia at gcc dot gnu dot org
  2010-01-06 10:42 ` jwakely dot gcc at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-29 19:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-12-29 19:26 -------
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).


-- 


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Bug other/42540] c++ error message [vtable undefined] is unhelpful
  2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
@ 2009-12-29 15:06 ` pinskia at gcc dot gnu dot org
  2009-12-29 19:27 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-29 15:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-12-29 15:05 -------
I don't know if there is anything there could be done here since the linker is
what is producing the error.


-- 


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


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2022-08-25  9:28 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-42540-4@http.gcc.gnu.org/bugzilla/>
2011-03-17 15:41 ` [Bug other/42540] c++ error message [vtable undefined] is unhelpful manu at gcc dot gnu.org
2011-03-17 16:17 ` jyasskin at gcc dot gnu.org
2020-07-22 13:56 ` redi at gcc dot gnu.org
2020-07-22 13:57 ` redi at gcc dot gnu.org
2020-07-22 13:57 ` redi at gcc dot gnu.org
2022-03-14 14:20 ` redi at gcc dot gnu.org
2022-03-14 14:38 ` eyalroz1 at gmx dot com
2022-03-14 17:15 ` redi at gcc dot gnu.org
2022-03-14 17:22 ` redi at gcc dot gnu.org
2022-03-16 20:13 ` eyalroz1 at gmx dot com
2022-03-16 20:34 ` redi at gcc dot gnu.org
2022-03-16 20:40 ` eyalroz1 at gmx dot com
2022-07-21 21:29 ` redi at gcc dot gnu.org
2022-08-25  9:11 ` manu at gcc dot gnu.org
2022-08-25  9:17 ` manu at gcc dot gnu.org
2022-08-25  9:28 ` redi at gcc dot gnu.org
2009-12-29 14:44 [Bug other/42540] New: " debian-gcc at lists dot debian dot org
2009-12-29 15:06 ` [Bug other/42540] " pinskia at gcc dot gnu dot org
2009-12-29 19:27 ` pinskia at gcc dot gnu dot org
2010-01-06 10:42 ` jwakely dot gcc at gmail dot com
2010-02-24 13:26 ` manu at gcc dot gnu dot org
2010-02-24 14:17 ` rearnsha at gcc dot gnu dot org
2010-07-06 15:47 ` pinskia at gcc dot gnu dot org
2010-07-13 22:56 ` jyasskin at gmail dot com
2010-07-13 22:58 ` pinskia at gcc dot gnu dot org
2010-07-13 22:58 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).