dr1301.cpp revision 1d0c9a8d0573d1f670f484cc17aa94f06be971a5
1// RUN: %clang_cc1 -std=c++11 -verify %s
2struct A { // expected-note 2{{candidate}}
3  A(int); // expected-note {{candidate}}
4  int n;
5};
6int a = A().n; // expected-error {{no matching constructor}}
7
8struct B {
9  B() = delete; // expected-note {{here}}
10  int n;
11};
12int b = B().n; // expected-error {{call to deleted}}
13
14struct C { // expected-note {{here}}
15  B b;
16};
17int c = C().b.n; // expected-error {{call to deleted}}
18
19struct D {
20  D() = default; // expected-note {{here}}
21  B b;
22};
23int d = D().b.n; // expected-error {{call to deleted}}
24
25struct E {
26  E() = default;
27  int n;
28};
29int e = E().n; // ok
30
31struct F {
32  F();
33  int n;
34};
35int f = F().n; // ok
36
37union G { // expected-note {{here}}
38  F f;
39};
40int g = G().f.n; // expected-error {{call to deleted}}
41
42struct H {
43  int n;
44private:
45  H(); // expected-note {{here}}
46};
47int h = H().n; // expected-error {{private constructor}}
48
49struct I { // expected-note {{here}}
50  H h;
51};
52int i = I().h.n; // expected-error {{call to deleted}}
53
54struct J {
55  J();
56  virtual int f();
57  int n;
58};
59int j1 = J().n; // ok
60int j2 = J().f(); // ok
61
62union K { // expected-note 2{{here}}
63  J j;
64  int m;
65};
66int k1 = K().j.n; // expected-error {{call to deleted}}
67int k2 = K().j.f(); // expected-error {{call to deleted}}
68