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

2024-12-19


1230. Confusing description of ambiguity of destructor name

Section: 7.6.2.2  [expr.unary.op]     Status: dup     Submitter: Johannes Schaub     Date: 2010-12-13

According to 7.6.2.2 [expr.unary.op] paragraph 10,

There is an ambiguity in the unary-expression ~X(), where X is a class-name or decltype-specifier. The ambiguity is resolved in favor of treating ~ as a unary complement rather than treating ~X as referring to a destructor.

It is not clear whether this is intended to apply to an expression like (~S)(). In large measure, that depends on whether a class-name is an id-expression or not. If it is, the ambiguity described in 7.6.2.2 [expr.unary.op] paragraph 10 does apply; if not, the expression is an unambiguous reference to the destructor for class S. There are several places in the Standard that indicate that the name of a type is an id-expression, but that might be more confusing than helpful.

Rationale (February, 2021):

This issue is a duplicate of, and resolved by the resolution of, issue 1971.