mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Merge pull request #833 from cubbimew/c127-ub
C.127 should not claim that there is a defined behavior
This commit is contained in:
commit
539d8a7d83
|
@ -6077,7 +6077,7 @@ A class with a virtual function is usually (and in general) used via a pointer t
|
||||||
// ... no user-written destructor, defaults to public nonvirtual ...
|
// ... no user-written destructor, defaults to public nonvirtual ...
|
||||||
};
|
};
|
||||||
|
|
||||||
// bad: class with a resource derived from a class without a virtual destructor
|
// bad: derived from a class without a virtual destructor
|
||||||
struct D : B {
|
struct D : B {
|
||||||
string s {"default"};
|
string s {"default"};
|
||||||
};
|
};
|
||||||
|
@ -6086,7 +6086,7 @@ A class with a virtual function is usually (and in general) used via a pointer t
|
||||||
{
|
{
|
||||||
auto p = make_unique<D>();
|
auto p = make_unique<D>();
|
||||||
// ...
|
// ...
|
||||||
} // calls B::~B only, leaks the string
|
} // undefined behavior. May call B::~B only and leak the string
|
||||||
|
|
||||||
##### Note
|
##### Note
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user