This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bad error messages from missing =0 on virtual function decl
- To: Carl Feynman <carlf at init dot com>
- Subject: Re: Bad error messages from missing =0 on virtual function decl
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 25 Aug 2000 00:06:30 +0200
- Cc: gcc-bugs at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <39A594F9.BB31032C@init.com>
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