Mercurial > hg > CbC > CbC_llvm
comparison clang/test/SemaCXX/dr1301.cpp @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 // RUN: %clang_cc1 -std=c++11 -verify %s | |
2 struct A { // expected-note 2{{candidate}} | |
3 A(int); // expected-note {{candidate}} | |
4 int n; | |
5 }; | |
6 int a = A().n; // expected-error {{no matching constructor}} | |
7 | |
8 struct B { | |
9 B() = delete; // expected-note 4{{here}} | |
10 int n; | |
11 }; | |
12 int b = B().n; // expected-error {{call to deleted}} | |
13 | |
14 struct C { | |
15 B b; // expected-note {{deleted default constructor}} | |
16 }; | |
17 int c = C().b.n; // expected-error {{call to implicitly-deleted default}} | |
18 | |
19 struct D { | |
20 D() = default; // expected-note {{here}} expected-warning {{implicitly deleted}} | |
21 B b; // expected-note 2{{'b' has a deleted default constructor}} | |
22 }; | |
23 int d = D().b.n; // expected-error {{call to implicitly-deleted default}} | |
24 | |
25 struct E { | |
26 E() = default; | |
27 int n; | |
28 }; | |
29 int e = E().n; // ok | |
30 | |
31 struct F { | |
32 F(); | |
33 int n; | |
34 }; | |
35 int f = F().n; // ok | |
36 | |
37 union G { | |
38 F f; // expected-note {{non-trivial default constructor}} | |
39 }; | |
40 int g = G().f.n; // expected-error {{call to implicitly-deleted default}} | |
41 | |
42 struct H { | |
43 int n; | |
44 private: | |
45 H(); // expected-note {{here}} | |
46 }; | |
47 int h = H().n; // expected-error {{private constructor}} | |
48 | |
49 struct I { | |
50 H h; // expected-note {{inaccessible default constructor}} | |
51 }; | |
52 int i = I().h.n; // expected-error {{call to implicitly-deleted default}} | |
53 | |
54 struct J { | |
55 J(); | |
56 virtual int f(); | |
57 int n; | |
58 }; | |
59 int j1 = J().n; // ok | |
60 int j2 = J().f(); // ok | |
61 | |
62 union K { | |
63 J j; // expected-note 2{{non-trivial default constructor}} | |
64 int m; | |
65 }; | |
66 int k1 = K().j.n; // expected-error {{call to implicitly-deleted default}} | |
67 int k2 = K().j.f(); // expected-error {{call to implicitly-deleted default}} |