This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bad error messages from missing =0 on virtual function decl


Carl Feynman <carlf@init.com> writes:

| [1  <text/plain; us-ascii (7bit)>]
| Dear GCC Maintainers--
| 
| I attatch two files, gcc-non-bug.cpp and gcc-bug.cpp.  They differ in
| that the latter is missing a "= 0" after the declaration of a pure
| virtual function.  This is wrong, and g++ properly rejects it.  However,
| the error message with which it is rejected is utterly incomprehensible
| to those of us not lucky enough to understand the internals of GCC:
| 
| /tmp/ccLjbuwZ.o: In function `child type_info function':
| /tmp/ccLjbuwZ.o(.text+0x45): undefined reference to `parent type_info
| function'
| /tmp/ccLjbuwZ.o(.text+0x4c): undefined reference to `parent type_info
| node'
| /tmp/ccLjbuwZ.o: In function `parent::parent(void)':
| /tmp/ccLjbuwZ.o(.parent::gnu.linkonce.t.(void)+0x8): undefined reference
| to `parent virtual table'
| collect2: ld returned 1 exit status
| 
| Perhaps this error could be made more understandable?  This file is of
| course a cut-down example of a much bigger file in which this bug led me
| on a merry chase.

What type of logic do you want the compiler to use in order to deduce that, 
actually, you meant a pure virtual function when you declared a
non-pure virtual function?  The best it can do is to report the use of
an undefined function. 

-- Gaby
CodeSourcery, LLC                             http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]