summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/defaulted53.C
blob: 8147e7e2ad11c565bf354c7c3e95c68260ad290e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Core Issue #1331 (const mismatch with defaulted copy constructor)
// { dg-do compile { target c++11 } }

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

struct R
{
  R& operator=(R&) = default;
  M m;
};

struct S
{
  S& operator=(const S&) = default;
  M m;
};

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

struct U
{
  // If F is an assignment operator, and T1's parameter type is
  // not a reference, the program is ill-formed.
  U& operator=(U) = default; // { dg-error "defaulted" }
  M m;
};