https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80452
Bug ID: 80452 Summary: [DR 1579] incorrect value category deduced for return value Product: gcc Version: 6.3.1 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- Core 1579 says this should compile, but the type is deduced as an lvalue reference: template<typename> struct check { }; template<typename T> struct check<T&>; struct A { A() = default; A(A&&) = default; A(const A&) = delete; }; template <class T> struct B { template <class U> B(U&&) { check<U> u; } }; B<A> f() { A a; return a; } bug.cc: In instantiation of ‘B<T>::B(U&&) [with U = A&; T = A]’: bug.cc:18:10: required from here bug.cc:12:40: error: ‘check<A&> u’ has incomplete type template <class U> B(U&&) { check<U> u; } ^ It seems r212099 was not enough to implement the DR.