Created on 2004-11-09.00:00:00 last changed 161 months ago
[Voted into the WP at the June, 2008 meeting.]
Proposed Resolution (November, 2006):
Change clause Clause 6 [basic] paragraphs 3-8 as follows:
An entity is a value, object,
subobject, base class subobject, array element,variable, function, instance of a function,enumerator, type, class member, template, namespace, or parameter pack.
A name is a use of an
identifier(5.10 [lex.name]) that denotes an entity or label (8.7.6 [stmt.goto], 8.2 [stmt.label]). A variable is introduced by the declaration of an object. The variable's name denotes the object.
Every name that denotes an entity is introduced by a declaration. Every name that denotes a label is introduced either by a goto statement (8.7.6 [stmt.goto]) or a labeled-statement (8.2 [stmt.label]).
Some names denote types
, classes, enumerations,or templates. In general, it is necessary to determine whether or not a name denotes one of these entities before parsing the program that contains it. The process that determines this is called name lookup (6.5 [basic.lookup]).
Two names are the same if
identifierscomposed of the same character sequence; or
the names of overloaded operator functionsformed with the same operator; or
the names of user-defined conversion functionsformed with the same type .
An identifierused in more than one translation unit can potentially refer to the same entity in these translation units depending on the linkage (6.6 [basic.link]) of the identifierspecified in each translation unit.
Change 6.4.6 [basic.scope.class] paragraph 1 item 5 as follows:
The potential scope of a declaration that extends to or past the end of a class definition also extends to the regions defined by its member definitions, even if the members are defined lexically outside the class (this includes static data member definitions, nested class definitions, member function definitions (including the member function body and any portion of the declarator part of such definitions which follows the
identifier, including a parameter-declaration-clause and any default arguments (188.8.131.52 [dcl.fct.default]).
[Drafting note: This last change is not really mandated by the issue, but it's another case of “identifier” confusion.]
(This proposed resolution also resolves issue 309.)
Clause Clause 6 [basic] paragraph 4 says:
A name is a use of an identifier (5.10 [lex.name]) that denotes an entity or label (8.7.6 [stmt.goto], 8.2 [stmt.label]).
Just three paragraphs later, it says
Two names are the same if
- they are identifiers composed of the same character sequence; or
- they are the names of overloaded operator functions formed with the same operator; or
- they are the names of user-defined conversion functions formed with the same type.
The last two bullets contradict the definition of name in paragraph 4 because they are not identifiers.
This definition affects other parts of the Standard, as well. For example, in 6.5.4 [basic.lookup.argdep] paragraph 1,
When an unqualified name is used as the postfix-expression in a function call (184.108.40.206 [expr.call]), other namespaces not considered during the usual unqualified lookup (6.5.3 [basic.lookup.unqual]) may be searched, and in those namespaces, namespace-scope friend function declarations (11.8.4 [class.friend]) not otherwise visible may be found.
With the current definition of name, argument-dependent lookup apparently does not apply to function-notation calls to overloaded operators.
Another related question is whether a template-id is a name or not and thus would trigger an argument-dependent lookup. Personally, I have always viewed a template-id as a name, just like operator+.
|2008-10-05 00:00:00||admin||set||status: dr -> cd1|
|2008-07-27 00:00:00||admin||set||messages: + msg1737|
|2008-06-29 00:00:00||admin||set||status: ready -> dr|
|2008-03-17 00:00:00||admin||set||status: review -> ready|
|2008-02-03 00:00:00||admin||set||messages: + msg1571|
|2008-02-03 00:00:00||admin||set||status: open -> review|