Double constructors in C++?

Ian Lance Taylor iant@google.com
Tue Feb 19 03:26:00 GMT 2008


Mark Mitchell <mark@codesourcery.com> writes:

> Ian Lance Taylor wrote:
> > Samuel Tardieu <sam@rfc1149.net> writes:
> >
> >> Why are constructors included twice in object code?
> > This is required by the C++ ABI.
> > It is, in my opinion, a real bug that gcc does not simply merge
> > identical constructors.
> 
> I agree.
> 
> Up until now, I think all of the patches have introduced additional
> thunks of some kind.  Actually giving both names to the same entry
> point would avoid the ABI problems, and thus be non-controversial.
> (The ABI explicitly endorses multiple entry points as a solution.)

I believe that it would be possible to construct some test cases with
shared libraries built in the current regime, including only one
version of the constructor, which will behave strangely in the new
regime.  I haven't actually tried to construct such a case, however.
I also would be happy to say that even if such a case could exist,
that we don't care about it.

Ian



More information about the Gcc mailing list