[expr.prim.id.dtor] (original) (raw)

7 Expressions [expr]

7.5 Primary expressions [expr.prim]

7.5.5 Names [expr.prim.id]

7.5.5.5 Destruction [expr.prim.id.dtor]

1

#

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

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 ([expr.ref]) that forms the postfix-expression of a function call ([expr.call]).

[Note 1:

Such a call ends the lifetime of the object ([expr.call], [basic.life]).

— _end note_]

3

#

[Example 1: struct C { };void f() { C * pc = new C;using C2 = C; pc->C::~C2(); // OK, destroys *pc C().C::~C(); // undefined behavior: temporary of type C destroyed twice using T = int;0 .T::~T(); // OK, no effect 0.T::~T(); // error: 0.T is a user-defined-floating-point-literal ([lex.ext]) } — _end example_]