Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/ref-qual3.C

raw
1 // An explicitly defaulted function can have a ref-qualifier.
2
3 // { dg-require-effective-target c++11 }
4
5 struct A {
6 A& operator=(const A&) & = default;
7 };
8
9 template<class T>
10 struct B {
11 B& operator=(const B&) & = default;
12 };
13
14 template<class T>
15 void f()
16 {
17 B<T> b;
18 b = B<T>();
19 B<T>() = b; // { dg-error "" }
20 }
21
22 int main()
23 {
24 A a;
25 a = A();
26 A() = a; // { dg-error "" }
27
28 f<int>();
29 }