This is the mail archive of the gcc@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: Bug? Where are these emitted?? (type_info, virtual table, etc)


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



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