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: linking problems


> > 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).


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