[Bug c++/59238] Dynamic allocating a list-initialized object of a type with private destructor fails.
davveston at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Dec 7 11:09:15 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59238
David Friberg <davveston at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |davveston at gmail dot com
--- Comment #1 from David Friberg <davveston at gmail dot com> ---
This bug is still present in GCC 10.1.0 and GCC trunk (for various C++
versions).
Related SO Q&A (https://stackoverflow.com/questions/65124761) list the
following examples as rejects-valid:
struct A { ~A() = delete; };
A *pa{new A{}};
class B { ~B() = default; };
B *pb{new B{}};
struct E {
~E() = delete;
private:
int x;
};
E *pe{new E{}};
whereas the following are all accepted (accepts-valid):
class C { ~C(); };
C *pc{new C{}}; // OK
class D { ~D() {} };
D *pd{new D{}}; // OK
struct F {
F() = default;
~F() = delete;
};
F *pf{new F{}};
struct G {
G() = default;
~G() = delete;
private:
int x;
};
G *pg{new G{}};
The SO Q&A lists standard passages to motivate that this is a rejects-valid, in
case this is challenged.
More information about the Gcc-bugs
mailing list