Annex F (informative)
Core undefined behavior
[ub]
F.6
[class]
: Classes
[ub.class]
F.6.5
[ub:class.cdtor.after.dtor]
Specified in:
[class.
cdtor]
1
#
For an object with a non-trivial destructor, referring to any non-static member or base class of the object after the destructor finishes execution has undefined behavior
.
2
#
[
Example
1
:
struct
X
{
int
i;
~
X
(
)
;
// non-trivial
}
; X
&
g
(
)
{
static
X x;
return
x;
}
void
f
(
)
{
X
*
px
=
&
g
(
)
; px
-
>
~
X
(
)
;
int
j
=
px
-
>
i;
// undefined behavior
}
—
end example
]