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: g++ looses an entire class.


On Dec  4, 1998, Scott A Crosby <crosby@qwes.math.cmu.edu> wrote:

> /root/Documents/programming/classes/indep_study/model_trivial.cpp:48:
> undefined reference to `Simple::Simple(int)'
> /root/Documents/programming/classes/indep_study/model_trivial.cpp:49:
> undefined reference to `Simple::~Simple(void)'
> /root/Documents/programming/classes/indep_study/model_trivial.cpp:49:
> undefined reference to `Simple::~Simple(void)'

No definition was provided for the declared destructors of classes
Model and Simple.  Therefore, according to the C++ Standard, your code
is invalid, because every non-abstract non-inline member-functions
must be given a definition in exactly one translation unit of a
program.

The constructor of Simple wasn't defined because of an optimization of
egcs (that is valid according to this restriction of the C++ Standard)
of only emitting out-of-line versions of inline functions in the
translation unit that defines the first non-abstract non-inline member 
function of a class.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
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]