Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
t3nsor opened this issue Mar 24, 2025 · 0 comments
Open

Comments

@t3nsor
Copy link

t3nsor commented Mar 24, 2025

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: ... ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant