https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101840
Bug ID: 101840 Summary: Friendship must be extended on default argument initializer Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fchelnokov at gmail dot com Target Milestone: --- The following program is correct: ``` class U{ ~U(); friend void foo(U); }; void foo(U = {}); ``` But GCC rejects it with the error: ``` error: 'U::~U()' is private within this context 2 | void foo(U = {}); | ^ ``` Clang and MSVC accept it: https://gcc.godbolt.org/z/eGxYGdzj3