1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
5 non_trivial(const non_trivial&);
6 non_trivial& operator = (const non_trivial&);
11 non_trivial nt; // expected-note {{non-trivial default constructor}}
13 bad_union u; // expected-error {{call to implicitly-deleted default constructor}}
14 union bad_union2 { // expected-note {{all data members are const-qualified}}
17 bad_union2 u2; // expected-error {{call to implicitly-deleted default constructor}}
21 non_trivial nt; // expected-note {{non-trivial default constructor}}
24 bad_anon a; // expected-error {{call to implicitly-deleted default constructor}}
26 union { // expected-note {{all data members of an anonymous union member are const-qualified}}
30 bad_anon2 a2; // expected-error {{call to implicitly-deleted default constructor}}
32 // This would be great except that we implement
46 struct good : non_trivial {
52 const good g; // expected-note {{field 'g' of const-qualified type 'const good' would not be initialized}}
54 bad_const bc; // expected-error {{call to implicitly-deleted default constructor}}
62 no_default() = delete; // expected-note 5{{deleted here}}
65 ~no_dtor() = delete; // expected-note 2{{deleted here}}
68 struct bad_field_default {
69 no_default nd; // expected-note {{field 'nd' has a deleted default constructor}}
71 bad_field_default bfd; // expected-error {{call to implicitly-deleted default constructor}}
72 struct bad_base_default : no_default { // expected-note {{base class 'no_default' has a deleted default constructor}}
74 bad_base_default bbd; // expected-error {{call to implicitly-deleted default constructor}}
76 struct bad_field_dtor {
77 no_dtor nd; // expected-note {{field 'nd' has a deleted destructor}}
79 bad_field_dtor bfx; // expected-error {{call to implicitly-deleted default constructor}}
80 struct bad_base_dtor : no_dtor { // expected-note {{base class 'no_dtor' has a deleted destructor}}
82 bad_base_dtor bbx; // expected-error {{call to implicitly-deleted default constructor}}
84 struct ambiguous_default {
86 ambiguous_default(int = 2);
88 struct has_amb_field {
89 ambiguous_default ad; // expected-note {{field 'ad' has multiple default constructors}}
91 has_amb_field haf; // expected-error {{call to implicitly-deleted default constructor}}
93 class inaccessible_default {
94 inaccessible_default();
96 struct has_inacc_field {
97 inaccessible_default id; // expected-note {{field 'id' has an inaccessible default constructor}}
99 has_inacc_field hif; // expected-error {{call to implicitly-deleted default constructor}}
101 class friend_default {
102 friend struct has_friend;
110 struct defaulted_delete {
111 no_default nd; // expected-note 2{{because field 'nd' has a deleted default constructor}}
112 defaulted_delete() = default; // expected-note{{implicitly deleted here}} expected-warning {{implicitly deleted}}
114 defaulted_delete dd; // expected-error {{call to implicitly-deleted default constructor}}
117 no_default nd; // expected-note {{because field 'nd' has a deleted default constructor}}
120 late_delete::late_delete() = default; // expected-error {{would delete it}}
122 // See also rdar://problem/8125400.
125 static union { union {}; };
126 static union { struct {}; };
127 static union { union { union {}; }; };
128 static union { union { struct {}; }; };
129 static union { struct { union {}; }; };
130 static union { struct { struct {}; }; };