1 // Core Issue #1331 (const mismatch with defaulted copy constructor) 2 // { dg-do compile { target c++11 } } 3 4 struct M 5 { 6 M& operator=(M&); 7 }; 8 9 struct R 10 { 11 R& operator=(R&) = default; 12 M m; 13 }; 14 15 struct S 16 { 17 S& operator=(const S&) = default; 18 M m; 19 }; 20 21 struct T 22 { 23 // If F is an assignment operator, and the return type of T1 24 // differs from the return type of T2 the program is ill-formed. 25 T operator=(T&) = default; // { dg-error "defaulted" } 26 M m; 27 }; 28 29 struct U 30 { 31 // If F is an assignment operator, and T1's parameter type is 32 // not a reference, the program is ill-formed. 33 U& operator=(U) = default; // { dg-error "defaulted" } 34 M m; 35 }; 36