summaryrefslogtreecommitdiffstats
path: root/test/CXX/special/class.copy/p11.0x.copy.cpp
blob: 752872adb9f5dc0492893cb81269725bc839bb75 (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
89
90
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s

struct NonTrivial {
  NonTrivial(const NonTrivial&);
};

union DeletedNTVariant { // expected-note{{here}}
  NonTrivial NT;
  DeletedNTVariant();
};
DeletedNTVariant DVa;
DeletedNTVariant DVb(DVa); // expected-error{{call to deleted constructor}}

struct DeletedNTVariant2 { // expected-note{{here}}
  union {
    NonTrivial NT;
  };
  DeletedNTVariant2();
};
DeletedNTVariant2 DV2a;
DeletedNTVariant2 DV2b(DV2a); // expected-error{{call to deleted constructor}}

struct NoAccess {
  NoAccess() = default;
private:
  NoAccess(const NoAccess&);

  friend struct HasAccess;
};

struct HasNoAccess { // expected-note{{here}}
  NoAccess NA;
};
HasNoAccess HNAa;
HasNoAccess HNAb(HNAa); // expected-error{{call to deleted constructor}}

struct HasAccess {
  NoAccess NA;
};

HasAccess HAa;
HasAccess HAb(HAa);

struct NonConst {
  NonConst(NonConst&);
};
struct Ambiguity {
  Ambiguity(const Ambiguity&);
  Ambiguity(volatile Ambiguity&);
};

struct IsAmbiguous { // expected-note{{here}}
  NonConst NC;
  Ambiguity A;
  IsAmbiguous();
};
IsAmbiguous IAa;
IsAmbiguous IAb(IAa); // expected-error{{call to deleted constructor}}

struct Deleted { // expected-note{{here}}
  IsAmbiguous IA;
};
Deleted Da;
Deleted Db(Da); // expected-error{{call to deleted constructor}}

struct NoAccessDtor {
private:
  ~NoAccessDtor();
  friend struct HasAccessDtor;
};

struct HasNoAccessDtor { // expected-note{{here}}
  NoAccessDtor NAD;
  HasNoAccessDtor();
  ~HasNoAccessDtor();
};
HasNoAccessDtor HNADa;
HasNoAccessDtor HNADb(HNADa); // expected-error{{call to deleted constructor}}

struct HasAccessDtor {
  NoAccessDtor NAD;
};
HasAccessDtor HADa;
HasAccessDtor HADb(HADa);

struct RValue { // expected-note{{here}}
  int && ri = 1;
};
RValue RVa;
RValue RVb(RVa); // expected-error{{call to deleted constructor}}