Double constructors in C++?

Mark Mitchell mark@codesourcery.com
Tue Feb 19 03:40:00 GMT 2008


Ian Lance Taylor wrote:

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

The ABI explicitly expects you to use multiple entry points, so either 
the ABI is broken, or the strangeness would come from some kind of 
undefined-ness.

However, the ABI does expect that if you have multiple constructor 
bodies for a constructor with vague linkage, then all of the copies are 
in the same COMDAT group.  If I recall correctly, we never fully 
enforced that on all platforms, and if the copies aren't all in the same 
COMDAT group, then, indeed, I can imagine that you could end up with one 
of the constructors coming from one place, and one from another -- which 
might be unfortunate.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc mailing list