Skip to content
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

[expr.prim.id.unqual] What id-expression denotes a destructor? CWG2738 #5449

Open
xmh0511 opened this issue May 5, 2022 · 5 comments
Open

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 5, 2022

In the current draft, we merely have a note that says

A type-name or decltype-specifier prefixed by ~ denotes the destructor of the type so named; see [expr.prim.id.dtor].

The note cross-references [expr.prim.id.dtor], however, in that subclause, we still cannot find a rule to specifies what id-expression denotes a destructor.

An id-expression that denotes the destructor of a type T names the destructor of T if T is a class type ([class.dtor]), otherwise the id-expression is said to name a pseudo-destructor.

Maybe, we should have a formal rule like that:

An unqualified-id with the form ~type-name or ~decltype-specifier denotes the destructor of a type denoted by the type-name or decltype-specifier([basic.lookup.qual.general]).

@jensmaurer
Copy link
Member

The note is in [expr.prim.id.unqual] p1

@xmh0511
Copy link
Contributor Author

xmh0511 commented May 5, 2022

The note is in [expr.prim.id.unqual] p1

We expect a formal rule to clarify that an id-expression denotes a destructor. BTW, I cited the note in this issue.

@frederick-vs-ja
Copy link
Contributor

It seems that we can just turn the note into a formal rule as-is.

@xmh0511
Copy link
Contributor Author

xmh0511 commented May 7, 2022

The note sounds good but it is not formal since the "so named" has no clear definition. I would prefer to use

A type-name or decltype-specifier prefixed by ~ denotes the destructor of the type denoted/referred to by it([basic.lookup], [dcl.type.decltype]).

@xmh0511
Copy link
Contributor Author

xmh0511 commented Jun 2, 2022

The note in [expr.prim.id.unqual]/1 suggests that [expr.prim.id.dtor] covers this (which might be why I missed it for P1787), but in fact the latter relies on "denotes the destructor" rather than defining it. This should perhaps be treated as a separate issue.

The separated issue as pointed out in #5346 (comment)

@jensmaurer jensmaurer changed the title [expr.prim.id.unqual] What id-expression denotes a destructor? [expr.prim.id.unqual] What id-expression denotes a destructor? CWG2738 May 27, 2023
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

3 participants