C++ PATCH to make namespace-scope anonymous types force internal linkage

Jason Merrill jason@redhat.com
Fri Sep 18 21:23:00 GMT 2009


My visibility overhaul a while back changed our handling of the 
anonymous namespace so that types defined in an anonymous namespace 
cause any declarations or template instantiations using those types to 
be file-local.  Now that with DR 757 we can use namespace-scope 
anonymous types in declarations with linkage, we should do the same with 
them to avoid name collisions on functions taking anonymous type, as in 
the testcase.

It occurs to me that this is only really correct for cases where the 
type in question shows up in the mangled name; a variable with external 
linkage defined in two translation units should give a link error even 
if both use a type which has some anonymity to it.  I'll address that in 
a later patch.

Tested x86_64-pc-linux-gnu, applied to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nolinkage-int.patch
Type: text/x-patch
Size: 8098 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090918/892758c7/attachment.bin>


More information about the Gcc-patches mailing list