Title
Wording problems in using-declaration specification
Status
c++14
Section
9.9 [namespace.udecl]
Submitter
Richard Smith

Created on 2012-09-06.00:00:00 last changed 81 months ago

Messages

Date: 2013-09-15.00:00:00

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

Date: 2013-06-15.00:00:00

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 (_N4868_.13.7.6 [temp.class.spec], 13.9.4 [temp.expl.spec]) are considered. —end note] [Example:
Date: 2012-10-15.00:00:00

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.

Date: 2012-10-15.00:00:00

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 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 (_N4868_.13.7.6 [temp.class.spec], 13.9.4 [temp.expl.spec]) are considered. —end note] [Example:...
Date: 2020-12-15.00:00:00

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 Clause 6 [basic] 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.”

History
Date User Action Args
2014-11-24 00:00:00adminsetstatus: drwp -> c++14
2014-03-03 00:00:00adminsetstatus: dr -> drwp
2013-10-14 00:00:00adminsetmessages: + msg4687
2013-10-14 00:00:00adminsetstatus: tentatively ready -> dr
2013-09-03 00:00:00adminsetmessages: + msg4458
2013-09-03 00:00:00adminsetstatus: drafting -> tentatively ready
2013-05-03 00:00:00adminsetstatus: review -> drafting
2012-11-03 00:00:00adminsetmessages: + msg4085
2012-11-03 00:00:00adminsetmessages: + msg4084
2012-11-03 00:00:00adminsetstatus: open -> review
2012-09-06 00:00:00admincreate