https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97648
Bug ID: 97648 Summary: Rejects valid direct initialization from prvalue (private destructor) Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: leni536 at gmail dot com Target Milestone: --- version: g++ (Compiler-Explorer-Build) 11.0.0 20201029 (experimental) options: -std=c++17 -O2 -pedantic-errors g++ rejects the following well-formed program: struct A { private: ~A(); public: static A f(); }; A* foo() { return new A(A::f()); } https://godbolt.org/z/hffYq7 On the return line no destructor is invoked or potentially invoked.