This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ looses an entire class.
- To: Scott A Crosby <crosby at qwes dot math dot cmu dot edu>
- Subject: Re: g++ looses an entire class.
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 06 Dec 1998 02:08:47 -0200
- Cc: egcs-bugs at cygnus dot com
- References: <Pine.LNX.3.95.981203232846.16009C-100000@qwe5.math.cmu.edu>
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