Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/defaulted1.C

raw
1 // PR c++/116162
2 // { dg-do compile { target c++23 } }
3
4 struct M
5 {
6 M& operator=(M&);
7 };
8
9 struct T
10 {
11 // if F1 is an assignment operator, and the return type of F1 differs
12 // from the return type, the program is ill-formed.
13 T operator=(this T&, T&) = default; // { dg-error "defaulted" }
14 M m;
15 };
16
17 struct U
18 {
19 // if F1's non-object parameter type is not a reference, the program
20 // is ill-formed.
21 U& operator=(this U&, U) = default; // { dg-error "defaulted" }
22 M m;
23 };