Created on 2025-06-10.00:00:00 last changed 1 month ago
Subclause 9.10 [namespace.udecl] paragraph 1 subtly changes the mechanics of name lookup for a using-declarator. This is better done in 6.5.1 [basic.lookup.general] to avoid the impression of conflicting rules.
Possible resolution:
Change in 6.5.1 [basic.lookup.general] paragraph 1 as follows:
... If the declarations found by name lookup all denote functions or function templates, the declarations are said to form an overload set. Otherwise, if the declarations found by name lookup do not all denote the same entity, they are ambiguous and the program is ill-formed, unless lookup is for a using-declarator. ...
Change in 6.5.1 [basic.lookup.general] paragraph 4 as follows:
In certain contexts, only certain kinds of declarations are included in the result of the search. Afteranyapplying suchrestrictionrestrictions (if any), any declarations of classes or enumerations are discarded if lookup is not for a using-declarator and any other declarations are found. [Note 4: A type (but not a type alias or template) is therefore hidden by any other entity in its scope. —end note] However, if a lookup is type-only, only declarations of types and templates whose specializations are types are considered; furthermore, if declarations of a type alias and of its underlying entity are found, the declaration of the type alias is discarded instead of the type declaration.
Change in 9.10 [namespace.udecl] paragraph 1 as follows:
Each using-declarator in a using-declaration [ Footnote: ... ] names the set of declarations found by lookup (6.5.5 [basic.lookup.qual]) for the using-declarator, except thatclass and enumeration declarations that would be discarded are merely ignored when checking for ambiguity (6.5 [basic.lookup]),conversion function templates with a dependent return type are ignored,and certain functions are hidden as described below.
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-06-10 00:00:00 | admin | create |