https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92031
Bug ID: 92031 Summary: Incorrect "taking address of r-value" error Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bugzilla at myosotissp dot com Target Milestone: --- In the following code, starting with gcc-9.1 gcc incorrectly fails to compile the template function f ("error: taking address of rvalue [-fpermissive]"). clang, icc and gcc-8.3 and earlier all accept it. Also, gcc-9.1 has no problem with the exact same code in a non-template function (see g() in the repro). --------------------------- struct x { const int& l; }; void a(const x&) {} template<class E> void f() { a(x { 0 }); } auto g() { a(x { 0 }); } --------------------------- Also, godbolt link: https://godbolt.org/z/YWLM5i