Wording inconsistency in the latest C++0x standard draft
Hi, I found several errors in the draft, I hope I am not wrong. Please
I refer to the latest draft N3242 or N3225 (no too much difference
In the draft, an unnamed namespace becomes internal linkage (it was
external linkage), the names used in unnamed namespace also becomes
internal linkage (they were external linkage except for namespace
name). As in 3.5/4,
"An unnamed namespace or a namespace declared directly or indirectly
within an unnamed namespace has internal linkage. All other namespaces
have external linkage. A name having namespace scope that has not been
given internal linkage above has the same linkage as the enclosing
But seems later usage of the term "external linkage" is not consistent
with this new definition, specifically,
1) 3.5/6 & 3.5/7
"Otherwise, if no matching entity is found, the block scope entity
receives external linkage."
"When a block scope declaration of an entity with linkage is not found
to refer to some other declaration, then that entity is a member of
the innermost enclosing namespace." ( The first quote is wrong because
that block scope entity might be a member of a namespace with internal
"[ Note: Member functions of a class in namespace scope have external
linkage. " (how about class member functions in unnamed namespace?)
"Static data members of a class in namespace scope have external
"A function first declared in a friend declaration has external
linkage" ( If I am not wrong, this friend function shall refer to a
function within the inner most enclosing namespace, and it might have
"A non-member function template can have internal linkage; any other
template name shall have external linkage."
6) 14.3.2/4 I am not sure about this one, looking for clarification.
I don't even understand why there is this rule.
"Temporaries, unnamed lvalues, and named lvalues that do not have
external linkage are not acceptable template-arguments when the
corresponding template-parameter has reference type."
"The instantiation context of an expression that depends on the
template arguments is the set of declarations with external linkage
declared prior to the point of instantiation of the template
specialization in the same translation unit."
I am not sure about this one but it looks suspicious to me. Names with
no linkage and with internal linkage can be used as template argument
now (If I am not wrong..), so why instantiation context must be
declarations with external linkage?
"If the function name is an unqualified-id and the call would be ill-
formed or would find a better match had the lookup within the
associated namespaces considered all the function declarations with
external linkage introduced in those namespaces in all translation
units, not just considering those declarations found in the template
definition and template instantiation contexts, then the program has
My comment same as (7).
Thanks for reading.
Re: Wording inconsistency in the latest C++0x standard draft
On 3 mar, 03:50, ZMZ <zhangmin...@gmail.com> wrote:
> Hi, I found several errors in the draft, I hope I am not wrong. Please
> I refer to the latest draft N3242 or N3225 (no too much difference
> with N3242).
> In the draft, an unnamed namespace becomes internal linkage (it was
> external linkage), the names used in unnamed namespace also becomes
> internal linkage (they were external linkage except for namespace
> name). As in 3.5/4,
> "An unnamed namespace or a namespace declared directly or indirectly
> within an unnamed namespace has internal linkage. All other namespaces
> have external linkage.
This part is the key:
> A name having namespace scope that has not been
> given internal linkage above has the same linkage as the enclosing
My understanding if that in the rest of the document, a name that has
not explicitely internal linkage has the linkage of enclosing
> But seems later usage of the term "external linkage" is not consistent
> with this new definition, specifically,
As I read it, each time you see "external linkage" hereafter, in
facts, it means "has linkage of the enclosing namespace". But if you
see internal linkage, it doesn't take into account the enclosing
IMHO, the wording have been kept for the general case (external
linkage) and anonymous namespace is kept has an exception.
|All times are GMT. The time now is 01:28 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.