This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-01-15


1551. Wording problems in using-declaration specification

Section: 9.9  [namespace.udecl]     Status: C++14     Submitter: Richard Smith     Date: 2012-09-06

[Moved to DR at the September, 2013 meeting.]

There are at least a couple of problems with the current wording of 9.9 [namespace.udecl]. First is the use of the word “entity” to describe what the using-declaration represents. For example, in paragraph 1,

If a using-declaration names a constructor (6.5.5.2 [class.qual]), it implicitly declares a set of constructors in the class in which the using-declaration appears (_N4527_.12.9 [class.inhctor]); otherwise the name specified in a using-declaration is a synonym for the name of some entity declared elsewhere.

An overload set of functions and function templates is not an “entity,” according to 6.1 [basic.pre] paragraph 3. A better phrasing might be something like, “...a synonym for a set of declarations in a different declarative region.”

The other problem is in paragraph 11:

The entity declared by a using-declaration shall be known in the context using it according to its definition at the point of the using-declaration. Definitions added to the namespace after the using-declaration are not considered when a use of the name is made.

This has the same problem with use of the term “entity,” and it also refers to “definitions” when presumably it means “declarations.”

Proposed resolution (October, 2012) [superseded]:

  1. Add the following as a new paragraph after 6.4.2 [basic.scope.pdecl] paragraph 3:

  2. The point of declaration for a class or class template first declared by a class-specifier is immediately after the identifier or simple-template-id (if any) in its class-head ( Clause 11 [class]). The point of declaration for an enumeration is immediately after the identifier (if any) in either its enum-specifier (9.7.1 [dcl.enum]) or its first opaque-enum-declaration (9.7.1 [dcl.enum]), whichever comes first. The point of declaration of an alias or alias template immediately follows the type-id to which the alias refers.

    The point of declaration of a using-declaration that does not name a constructor is immediately after the using-declaration (9.9 [namespace.udecl]).

  3. Change 9.9 [namespace.udecl] paragraph 1 as follows:

  4. ...If a using-declaration names a constructor (6.5.5.2 [class.qual]), it implicitly declares a set of constructors in the class in which the using-declaration appears (_N4527_.12.9 [class.inhctor]); otherwise the name specified in a using-declaration is a synonym for the name of some entity declared elsewhere a set of declarations in another namespace or class.
  5. Change 9.9 [namespace.udecl] paragraph 11 as follows:

  6. The entity declared by a using-declaration shall be known in the context using it according to its definition at the point of the using-declaration. Definitions Declarations added to the namespace after the using-declaration are not considered when a use of the name is made. [Note: Thus, additional overloads and default arguments (9.3.4.7 [dcl.fct.default]) added after the using-declaration are ignored, but template specializations (13.7.6 [temp.spec.partial], 13.9.4 [temp.expl.spec]) are considered. —end note] [Example:...

Additional note (October, 2012):

The note added by this resolution to 9.9 [namespace.udecl] paragraph 11 regarding the treatment of default arguments directly contradicts the normative statement of 9.3.4.7 [dcl.fct.default] paragraph 9:

When a declaration of a function is introduced by way of a using-declaration (9.9 [namespace.udecl]), any default argument information associated with the declaration is made known as well. If the function is redeclared thereafter in the namespace with additional default arguments, the additional arguments are also known at any point following the redeclaration where the using-declaration is in scope.

The issue has been returned to "review" status for reconciliation of these two passages.

Proposed resolution (June, 2013):

  1. Insert a new paragraph following 6.4.2 [basic.scope.pdecl] paragraph 3, as follows

  2. ...whichever comes first. The point of declaration of an alias or alias template immediately follows the type-id to which the alias refers.

    The point of declaration of a using-declaration that does not name a constructor is immediately after the using-declaration (9.9 [namespace.udecl]).

    The point of declaration for an enumerator...

  3. Change 9.9 [namespace.udecl] paragraph 1 as follows:

  4. ...If a using-declaration names a constructor (6.5.5.2 [class.qual]), it implicitly declares a set of constructors in the class in which the using-declaration appears (_N4527_.12.9 [class.inhctor]); otherwise the name specified in a using-declaration is a synonym for the name of some entity declared elsewhere a set of declarations in another namespace or class.
  5. Change 9.9 [namespace.udecl] paragraph 11 as follows:

  6. The entity declared by a using-declaration shall be known in the context using it according to its definition at the point of the using-declaration. Definitions Members added to the namespace after the using-declaration are not considered when a use of the name is made. [Note: Thus, additional overloads added after the using-declaration are ignored, but default function arguments (9.3.4.7 [dcl.fct.default]), default template arguments (13.2 [temp.param]), and template specializations (13.7.6 [temp.spec.partial], 13.9.4 [temp.expl.spec]) are considered. —end note] [Example: