aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/defaulted1.C
blob: 00cf894fa1d9da4119345d8b6e8632a77a7db5a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/116162
// { dg-do compile { target c++23 } }

struct M
{
  M& operator=(M&);
};

struct T
{
  // if F1 is an assignment operator, and the return type of F1 differs
  // from the return type,  the program is ill-formed.
  T operator=(this T&, T&) = default; // { dg-error "defaulted" }
  M m;
};

struct U
{
  // if F1's non-object parameter type is not a reference, the program
  // is ill-formed.
  U& operator=(this U&, U) = default; // { dg-error "defaulted" }
  M m;
};