CWG Issue 2218 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
2218. Ambiguity and namespace aliases
Section: 6.5 [basic.lookup]Status: C++17Submitter: Richard SmithDate: 2015-12-29
[Adopted at the February/March, 2017 meeting.]
There is implementation divergence on the status of the following example:
namespace A { namespace B { int x; } } namespace C { namespace B = A::B; } using namespace A; using namespace C; int x = B::x;
This should presumably be valid: the lookup of B findsA::B and C::B, but it is not ambiguous because they denote the same entity. A similar example with a _using-declaration_or alias-declaration seems to be universally accepted. Perhaps the lookup rules need to be clarified regarding the status of this example.
Proposed resolution (November, 2016):
Change 6.5 [basic.lookup] paragraph 1 as follows:
The name lookup rules apply uniformly to all names (including _typedef-name_s (9.2.4 [dcl.typedef]), _namespace-name_s (9.9 [basic.namespace]), and _class-name_s (11.3 [class.name])) wherever the grammar allows such names in the context discussed by a particular rule. Name lookup associates the use of a name with a
declarationset of declarations(6.2 [basic.def]) of that name.Name lookup shall find an unambiguous declaration for the name (see 6.5.2 [class.member.lookup]). Name lookup may associate more than one declaration with a name if it finds the name to be a function name;The declarations found by name lookup shall either all declare the same entity or shall all declare functions; in the latter case, the declarations are said to form a set of overloaded functions (_N4868_.12.2 [over.load]). Overload resolution...