1 // RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++11 %s
4 // RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s
5 // RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++98 %s
6 // RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++11 %s
9 // The Microsoft ABI doesn't have the concept of key functions, so we have different
10 // expectations about when functions are first required for that case.
12 class NoDestroy
{ ~NoDestroy(); };
13 #if __cplusplus <= 199711L
14 // expected-note@-2 3 {{declared private here}}
16 // expected-note@-4 3 {{declared private here}}
22 #if __cplusplus >= 201103L
23 // expected-note@-2 3 {{overridden virtual function is here}}
27 struct B
: public virtual A
{
28 #if __cplusplus >= 201103L
29 // expected-error@-2 {{deleted function '~B' cannot override a non-deleted function}}
30 // expected-note@-3 {{overridden virtual function is here}}
34 #if __cplusplus <= 199711L
35 // expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
37 // expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
40 // expected-note@-7 {{destructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
42 // expected-note@-9 {{default constructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
47 struct D
: public virtual B
{
48 #if __cplusplus <= 199711L
50 // expected-note@-3 {{implicit default constructor for 'B' first required here}}
51 // expected-note@-4 {{implicit destructor for 'B' first required here}}
55 // expected-note@-8 {{default constructor of 'D' is implicitly deleted because base class 'B' has a deleted default constructor}}
60 #if __cplusplus >= 201103L
61 //expected-error@-2 {{non-deleted function '~D' cannot override a deleted function}}
67 #if __cplusplus <= 199711L
68 // expected-note@-2 2{{implicit default constructor for 'D' first required here}}
70 // expected-error@-4 {{call to implicitly-deleted default constructor of 'D'}}å
74 #if __cplusplus <= 199711L
75 // expected-note@-2 {{implicit destructor for 'B' first required here}}
80 struct E
: public virtual A
{
81 #if __cplusplus >= 201103L
82 // expected-error@-2 {{deleted function '~E' cannot override a non-deleted function}}
86 #if __cplusplus <= 199711L
87 // expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
89 // expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
92 // expected-note@-7 {{destructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
94 // expected-note@-9 {{default constructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
100 #if __cplusplus <= 199711L
101 // expected-note@-2 {{implicit destructor for 'E' first required here}}
103 // expected-note@-4 {{implicit default constructor for 'E' first required here}}
106 // expected-note@-7 {{overridden virtual function is here}}
108 // expected-note@-9 {{default constructor of 'F' is implicitly deleted because base class 'E' has a deleted default constructor}}
114 struct G
: public virtual F
{
116 #if __cplusplus <= 199711L
117 // expected-note@-3 {{implicit default constructor for 'F' first required here}}
118 // expected-note@-4 {{implicit destructor for 'F' first required here}}
120 // expected-note@-6 {{default constructor of 'G' is implicitly deleted because base class 'F' has a deleted default constructor}}
126 #if __cplusplus >= 201103L
127 //expected-error@-2 {{non-deleted function '~G' cannot override a deleted function}}
133 #if __cplusplus <= 199711L
134 // expected-note@-2 2{{implicit default constructor for 'G' first required here}}
136 // expected-error@-4 {{call to implicitly-deleted default constructor of 'G'}}
140 #if __cplusplus <= 199711L
141 // expected-note@-2 {{implicit destructor for 'F' first required here}}
146 struct H
: public virtual A
{
147 #if __cplusplus >= 201103L
148 // expected-error@-2 {{deleted function '~H' cannot override a non-deleted function}}
149 // expected-note@-3 {{overridden virtual function is here}}
153 #if __cplusplus <= 199711L
154 // expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
156 // expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
159 // expected-note@-7 {{destructor of 'H' is implicitly deleted because field 'x' has an inaccessible destructor}}
161 // expected-note@-9 {{default constructor of 'H' is implicitly deleted because field 'x' has an inaccessible destructor}}
166 struct I
: public virtual H
{
168 #if __cplusplus > 199711L
169 // expected-note@-3 {{default constructor of 'I' is implicitly deleted because base class 'H' has a deleted default constructor}}
174 #if __cplusplus >= 201103L
175 // expected-error@-2 {{non-deleted function '~I' cannot override a deleted function}}
179 struct J
: public I
{
181 #if __cplusplus <= 199711L
182 // expected-note@-3 {{implicit default constructor for 'H' first required here}}
183 // expected-note@-4 {{implicit destructor for 'H' first required here}}
185 // expected-note@-6 {{default constructor of 'J' is implicitly deleted because base class 'I' has a deleted default constructor}}
195 #if __cplusplus <= 199711L
196 // expected-note@-2 2{{implicit default constructor for 'J' first required here}}
198 // expected-error@-4 {{call to implicitly-deleted default constructor of 'J'}}
203 #if __cplusplus <= 199711L
204 // expected-note@-2 {{implicit destructor for 'H' first required here}}