https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110195
Bug ID: 110195 Summary: defaulted constructor does not respect the private accessor Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jack.cui2 at foxmail dot com Target Milestone: --- class Single { private: Single() = default; }; auto s1 = Single{}; // compiles fine with c++11,14,17. Compilation error with c++20. Unexpected. auto s2 = Single(); // compilation error. expected behavior. Single s3; // compilation error. expected behavior. ---------------------------- but with class Single { private: explicit Single() = default; }; or class Single { private: Single() {} }; auto s1 = Single{}; // compilation error. expected behavior. auto s2 = Single(); // compilation error. expected behavior. Single s3; // compilation error. expected behavior.