An unnamed-namespace-definition behaves as if it were replaced by
inlineopt namespace unique { /* empty body */ } using namespace unique ; namespace unique { namespace-body }
where inline appears if and only if it appears in the unnamed-namespace-definition and all occurrences of unique in a translation unit are replaced by the same identifier, and this identifier differs from all other identifiers in the translation unit. The optional attribute-specifier-seq in the unnamed-namespace-definition appertains to unique. [âExample:
namespace { int i; } // uniqueâ::âi void f() { i++; } // uniqueâ::âi++ namespace A { namespace { int i; // Aâ::âuniqueâ::âi int j; // Aâ::âuniqueâ::âj } void g() { i++; } // Aâ::âuniqueâ::âi++ } using namespace A; void h() { i++; // error: uniqueâ::âi or Aâ::âuniqueâ::âi A::i++; // Aâ::âuniqueâ::âi j++; // Aâ::âuniqueâ::âj }
âââend exampleâ]