Annex F (informative)
Core undefined behavior
[ub]
F.6
[class]
: Classes
[ub.class]
F.6.2
[ub:class.abstract.pure.virtual]
Specified in:
[class.
abstract]
1
#
Calling a pure virtual function from a constructor or destructor in an abstract class has undefined behavior
.
2
#
[
Example
1
:
struct
B
{
virtual
void
f
(
)
=
0
; B
(
)
{
f
(
)
;
// undefined behavior,
f
is pure virtual and is being called from the constructor
}
}
;
struct
D
:
B
{
void
f
(
)
override
;
}
;
—
end example
]