https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101873
Bug ID: 101873 Summary: Compilation error of valid code with return local variable in C++20 mode 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 program as follows fails to compile in C++20 mode: ``` struct U { U(int) {} U(int&&) {} }; U foo(int a = 0) { return a; } int main() { foo(); } ``` But it is a valid program and other compilers accept it: https://gcc.godbolt.org/z/fMvEPMGhq