Skip to content

CWG3028 [namespace.udecl] A using-declarator does not introduce a name, but should #692

@t3nsor

Description

@t3nsor

Full name of submitter: Brian Bi

Link to Mattermost thread: https://chat.isocpp.org/general/pl/3w7furqo4i8pfydse13d9tb4th

Issue description: A using-declarator that doesn't name a constructor should bind the unqualified-id in the scope where it appears. The note in [namespace.udecl]/2 suggests that the name is bound, but is not normative and doesn't specify the scope in which it's bound. Also, it is not clear whether there is actually a normative prohibition on something like using X::~X;.

Suggested resolution: Edit the grammar for [namespace.udecl] as shown:

using-declarator:
    typenameopt nested-name-specifier unqualified-id using-declarator-id

using-declarator-id:
    identifier
    operator-function-id
    conversion-function-id
    literal-operator-id

In [namespace.udecl]/1, replace both occurrences of "unqualified-id" with "using-declarator-id".

Edit [namespace.udecl]/2:

If the using-declarator names a constructor, it declares that the class inherits the named set of constructor declarations from the nominated base class. Otherwise, the using-declarator introduces its using-declarator-id. [Note 1: Otherwise, the unqualified-id in the using-declarator is bound to During name lookup, the using-declarator , which is replaced during name lookup with the declarations it names ([basic.lookup]). If such a declaration is of an enumeration, the names of its enumerators are not bound. For the keyword typename, see [temp.res]. — end note]

Strike Note 2 at the beginning of [namespace.udecl]/4:

[Note 2: Since destructors do not have names, a using-declaration cannot refer to a destructor for a base class. — end note] [...]

Strike [namespace.udecl]/5:

A using-declaration shall not name a template-id. [Example 3: ... ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions