Naming a destructor via decltype
11.4.7 [class.dtor]
Steve Clamage

Created on 2012-11-14.00:00:00 last changed 111 months ago


Date: 2015-04-13.00:00:00

Additional note, April, 2015:

EWG has decided not to make a change in this area. See EWG issue 112.

Date: 2013-11-15.00:00:00

Rationale (November, 2013):

CWG felt that the suggested change should be considered by EWG before the issue is resolved.

Date: 2013-04-15.00:00:00

Notes from the April, 2013 meeting:

CWG favored replacing the existing syntax with something more flexible, for example, p->~auto(). This new syntax would also apply to pseudo destructors.

Date: 2012-11-14.00:00:00

Use of a decltype-specifier to name a destructor in an explicit destructor call is explicitly permitted in 11.4.7 [class.dtor] paragraph 13. However, the most straightforward attempt to do so, e.g.,


does not work, because *p is an lvalue and thus decltype(*p) is a reference type, not a class type. Even simply eliminating the reference is not sufficient, because p could be a pointer to a cv-qualified class type.

Either the provision for decltype-specifiers in explicit destructor calls should be removed or the specification should be expanded to allow reference and cv-qualified types to be considered as “denot[ing] the destructor's class type.”

Date User Action Args
2015-04-13 00:00:00adminsetmessages: + msg5434
2015-04-13 00:00:00adminsetstatus: extension -> nad
2014-01-20 00:00:00adminsetmessages: + msg4795
2014-01-20 00:00:00adminsetstatus: drafting -> extension
2013-05-03 00:00:00adminsetmessages: + msg4341
2013-05-03 00:00:00adminsetstatus: open -> drafting
2012-11-14 00:00:00admincreate