// An explicitly defaulted function can have a ref-qualifier. // { dg-require-effective-target c++11 } struct A { A& operator=(const A&) & = default; }; template struct B { B& operator=(const B&) & = default; }; template void f() { B b; b = B(); B() = b; // { dg-error "" } } int main() { A a; a = A(); A() = a; // { dg-error "" } f(); }