Bug? Where are these emitted?? (type_info, virtual table, etc)

Alexandre Oliva oliva@dcc.unicamp.br
Tue Oct 6 02:40:00 GMT 1998


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




More information about the Gcc mailing list