aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/implicit-move4.C
blob: 09ac5c93ab92d16aedc7e647c35093e306b8494d (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// PR c++/113853
// { dg-do compile { target c++20 } }

struct X {
  X();
  X(const X&);
  X(X&&) = delete;
};

void
f1 ()
{
  try {
    ;
  } catch (X x) {
    throw x; // { dg-error "use of deleted function" }
  }
}

void
f2 (X x)
try {
  ;
} catch (...) {
  throw x;  // { dg-error "use of deleted function" }
}

void
f2b (X x)
try {
  ;
} catch (...) {
  {
    throw x;  // { dg-error "use of deleted function" }
  }
}

void
f3 ()
try {
  X x;
  throw x;  // { dg-error "use of deleted function" }
} catch (...) {
}

void
f3b ()
try {
  {
    X x;
    throw x;  // { dg-error "use of deleted function" }
  }
} catch (...) {
}

void
f4 (X x)
try {
  throw x;
} catch (...) {
}

void
f4b (X x)
try {
  {
    throw x;
  }
} catch (...) {
}

void
f5 (X x)
{
  void g (decltype(throw x, true));	// { dg-error "use of deleted function|expected" }
}

// The "expected" shouldn't be here, c++/113924.
void
f6 (X x, int = decltype(throw x, true){}) // { dg-error "use of deleted function|expected" }
{
}

void
f7 (X x)
{
  [&] { throw x; };
}