This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: linking problems
- To: aoliva at cygnus dot com (Alexandre Oliva)
- Subject: Re: linking problems
- From: Joe Buck <jbuck at possibly dot synopsys dot com>
- Date: Thu, 20 Apr 2000 18:40:57 -0700 (PDT)
- Cc: js1 at microwave dot ph dot msstate dot edu (Jiann-Ming Su), gcc at gcc dot gnu dot org
> > The strange thing is this code had linked previously. I've added new
> > code, but none relating to this function.
Alexandre Oliva writes:
> Is this member function inline? Did you add some non-inline methods
> to the same class? GCC uses heuristics to emit out-of-line copies of
> inline methods: they're only emitted in the translation unit
> containing the first non-inline non-abstract member function of the
> class. This assumption is valid because the C++ Standard requires
> every non-abstract member function to be defined.
Actually it's the first non-inline *virtual* member function that
determines which translation unit is used; nonvirtual member functions do
not need to be defined (and I don't believe the standard requires
nonvirtual members that are never called to be defined, as this would
break the common technique of forbidding copying of an object by declaring
the copy constructor private and not implementing it).