http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54791



--- Comment #11 from David Edelsohn <dje at gcc dot gnu.org> 2012-11-05 
18:54:47 UTC ---

I believe that the G++ front end tries to create a unique name from the first

symbol it sees.  I do not now if this is related to the constructor name

collision that you are seeing.



Is it valid C++ to define an object with the same name in multiple files? I

cannot tell if you were doing something that happened to work but the behavior

is not clearly defined by the language, or if this is allowed and does not work

on AIX, in which case it is a bug.



Why does inlining or not inlining affect the name collision?



Do SVR4/ELF systems mangle each of the constructors uniquely?  I thought that

they all would end up in the ".init" sections, which will be concatenated. I am

curious how the calls to the different ctors are disambiguated at link time.



collect2 could warn, but it currently does not scan the constructor names it

finds for duplicates in its object file scan.  A warning would be nice, but I

do not know if it is valid C++ that it should expect.



I am not sure what you mean by order of initialization of global constructors

across compilation units.  This is within one library?  GCC has a way to

decorate constructors with a priority to order the constructors. If you mean

order of constructors among multiple shared libraries, that is a separate,

known issue on AIX.

Reply via email to