This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug? Where are these emitted?? (type_info, virtual table, etc)
- To: "pedwards at ball dot com" <pedwards at ball dot com>
- Subject: Re: Bug? Where are these emitted?? (type_info, virtual table, etc)
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 06 Oct 1998 06:38:38 -300
- Cc: "'egcs at cygnus dot com'" <egcs at cygnus dot com>
- References: <01BDF090.D125E380.pedwards@ball.com>
Phil Edwards <pedwards@ball.com> writes:
> DBR type_info node ./lib/libDBR.so
> DBR type_info function ./lib/libDBR.so
> DBR virtual table ./lib/libDBR.so
> Everything was fine until this fn was added to the DBR public block:
> virtual int foo () const; // NOT implemented
> Is this a problem with egcs 1.1, or am I violating the Standard?
The standard says:
8 A virtual function declared in a class shall be defined, or declared
pure (_class.abstract_) in that class, or both; but no diagnostic is
required (_basic.def.odr_).
So you're violating the standard by not providing a definition of a
virtual non-abstract member function.
gcc will emit the virtual table of a class in the translation unit
that contains the definition of the first non-inline non-abstract
member function. Strangely, this is heuristics is documented as
enabled only if -fvtable-thunks is enabled, but it is not enabled by
default on Solaris.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil