[Bug c++/44841] Add suggestion to "undefined reference to `vtable for ...´"

phresnel at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jul 7 06:29:00 GMT 2010



------- Comment #3 from phresnel at gmail dot com  2010-07-07 06:29 -------
(In reply to comment #1)
> (In reply to comment #0)
> > 
> >   undefined reference to `vtable for IFoo'
> >   Suggestions:
> >    * Ensure that no (pure) member function of `IFoo' became unintentionally
> > non-pure because of a missing or deleted `= 0'
> 
> While I think adding a note would be helpful, the suggestion above is
> ridiculous. It certainly shouldn't be the first suggestion.  

Of course this was just a quick scratch, but stating it's ridiculous is
unnecessarily offending, i.e. ridiculous in itself.

> The answer is to
> ensure the first, non-inline virtual function is defined. That's it. 

In my humble opinion, no it's not the answer, at least not in my, and I guess
in many people's cases. I did not want to define it, but wanted to have a
purely virtual function, without definition.

Again, the wording is just a quick scratch, but your "answer which is it" is
not necessarily the right solution either.

> Suggestions about "unintentionally becoming non-pure" would cause more 
> confusion than they would help.

Well, it can be rephrased. Maybe something like "Did you intend to make it a
pure virtual function? Add `= 0' then. Otherwise, ensure to define the
function." would be the better solution.

> 
> However, the error comes from the linker, so there's nothing gcc can do about
> it when compiling.
> 

Okay, my fail to not know that ld bugs don't go here.


-- 


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



More information about the Gcc-bugs mailing list