Annex F (informative)
Core undefined behavior
[ub]
F.2
[basic]
: Basics
[ub.basic]
F.2.6
[ub:lifetime.outside.pointer.virtual]
Specified in:
[basic.
life]
1
#
For a pointer pointing to an object outside of its lifetime, behavior is undefined if the pointer is implicitly converted (
[conv.
ptr]
) to a pointer to a virtual base class (or base class of a virtual base class)
.
2
#
[
Example
1
:
struct
B
{
}
;
struct
D
:
virtual
B
{
}
;
void
f
(
)
{
D d; D
*
p
=
&
d; d
.
~
D
(
)
; B
*
b
=
p;
// undefined behavior
}
—
end example
]