Title
Parentheses in pseudo-destructor calls
Status
drafting
Section
7.5.4.4 [expr.prim.id.dtor]
Submitter
Mike Miller

Created on 2020-12-15.00:00:00 last changed 4 months ago

Messages

Date: 2020-12-15.00:00:00

According to 7.5.4.4 [expr.prim.id.dtor] paragraph 2,

If the id-expression names a pseudo-destructor, T shall be a scalar type and the id-expression shall appear as the right operand of a class member access (7.6.1.5 [expr.ref]) that forms the postfix-expression of a function call (7.6.1.3 [expr.call]).

This would appear to make the following example ill-formed, because it is the parenthesized expression and not the class member access that is the postfix-expression in the function call:

  typedef int T;
  void f(int* p) {
    (p->~T)();   // Ill-formed?
  }

Presumably this is an oversight.

History
Date User Action Args
2020-12-15 00:00:00admincreate