This note appears in the discussion of name hiding and uniqueness:
§3.3 #4[Note: these restrictions apply to the declarative region into which
a name is introduced, which is not necessarily the same as the region in
which the declaration occurs. In particular, elaborated-type-specifiers
(3.3.1) and friend declarations (11.4) may introduce a (possibly not
visible) name into an enclosing namespace; these restrictions apply to that
region. Local extern declarations (3.5) may introduce a name into the
declarative region where the declaration appears and also introduce a
(possibly not visible) name into an enclosing namespace; these restrictions
apply to both regions.]
This note is item #6 in the discussion of "Point of declaration"
§3.3.1 #6[Note: friend declarations refer to functions or classes that are
members of the nearest enclosing namespace, but they do not introduce new
names into that namespace (7.3.1.2). Function declarations at block scope
and object declarations with the extern specifier at block scope refer to
declarations that are members of an enclosing namespace, but they do not
introduce new names into that scope. ]
What exactly do these statements mean?
"[E]laborated-type-specifiers and friend declarations may introduce a
(possibly not visible) name into an enclosing namespace;"
"Local extern declarations may introduce a name into the declarative region
where the declaration appears and also introduce a (possibly not visible)
name into an enclosing namespace;"
"Friend declarations refer to functions or classes that are members of the
nearest enclosing namespace, but they do not introduce new names into that
namespace"
"[O]bject declarations with the extern specifier at block scope refer to
declarations that are members of an enclosing namespace, but they do not
introduce new names into that scope."
Not only do I not understand their basic meaning, they seem contradictory to
me. The part about "elaborated-type-specifiers" I take to mean "forward
declarations", and the statement appears to mean that bar is introduced
into the namespace foo in this example:
namespace foo{ class bar; }
But what is it saying the friend declaration is introducing into the
namespace foo in this example?
namespace foo{ struct bar{ friend void baz(int i); }; }
The same goes for extern?
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/