This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


2473. Parentheses in pseudo-destructor calls

Section: 7.5.4.5  [expr.prim.id.dtor]     Status: drafting     Submitter: Mike Miller     Date: 2020-12-15

According to 7.5.4.5 [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.