Lines Matching +full:da +full:- +full:f

1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -triple %itanium_abi_triple -verify -Wreinterpret-base-
2 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -Wreinterpret-ba…
4 …%clang_cc1 -std=c++11 -fsyntax-only -triple %itanium_abi_triple -fdiagnostics-parseable-fixits -Wr…
5 …ot %clang_cc1 -std=c++11 -fsyntax-only -triple %ms_abi_triple -fdiagnostics-parseable-fixits -Wrei…
10 class DA : public A { class
12 class DDA : public DA {
21 class DDVA : public virtual DA {
23 …lic virtual DA { //expected-warning{{direct base 'A' is inaccessible due to ambiguity:\n class …
29 // Do not fail on incompletely-defined classes.
44 // Do not fail on erroneous classes with fields of incompletely-defined types.
47 struct A; // expected-note {{forward declaration of 'BaseMalformed::A'}}
49 A a; // expected-error {{field has incomplete type 'BaseMalformed::A'}}
57 struct A; // expected-note {{forward declaration of 'ChildMalformed::A'}}
60 A a; // expected-error {{field has incomplete type 'ChildMalformed::A'}}
65 // Base class outside upcast base-chain is malformed.
67 struct A; // expected-note {{forward declaration of 'BaseBaseMalformed::A'}}
69 struct X { A a; }; // expected-error {{field has incomplete type 'BaseBaseMalformed::A'}}
76 struct A; // expected-note {{forward declaration of 'InheritanceMalformed::A'}}
77 struct B : A {}; // expected-error {{base class has incomplete type}}
82 // Virtual base class outside upcast base-chain is malformed.
84 struct A; // expected-note {{forward declaration of 'VBaseMalformed::A'}}
85 struct X { A a; }; // expected-error {{field has incomplete type 'VBaseMalformed::A'}}
110 (void)*reinterpret_cast<DA *>(a); in reinterpret_pointer_downcast()
111 (void)*reinterpret_cast<const DA *>(a); in reinterpret_pointer_downcast()
112 (void)*reinterpret_cast<volatile DA *>(a); in reinterpret_pointer_downcast()
113 (void)*reinterpret_cast<const volatile DA *>(a); in reinterpret_pointer_downcast()
115 (void)*reinterpret_cast<const DA *>(ca); in reinterpret_pointer_downcast()
116 (void)*reinterpret_cast<const volatile DA *>(ca); in reinterpret_pointer_downcast()
121 …// expected-warning@+2 {{'reinterpret_cast' to class 'DVA *' from its virtual base 'A *' behaves d… in reinterpret_pointer_downcast()
122 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in reinterpret_pointer_downcast()
124 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_downcast()
126 …// expected-warning@+2 {{'reinterpret_cast' to class 'DDVA *' from its virtual base 'A *' behaves … in reinterpret_pointer_downcast()
127 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in reinterpret_pointer_downcast()
129 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_downcast()
131 …// expected-warning@+2 {{'reinterpret_cast' to class 'DMA *' from its virtual base 'A *' behaves d… in reinterpret_pointer_downcast()
132 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in reinterpret_pointer_downcast()
134 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_downcast()
138 (void)reinterpret_cast<DA &>(a); in reinterpret_reference_downcast()
139 (void)reinterpret_cast<const DA &>(a); in reinterpret_reference_downcast()
140 (void)reinterpret_cast<volatile DA &>(a); in reinterpret_reference_downcast()
141 (void)reinterpret_cast<const volatile DA &>(a); in reinterpret_reference_downcast()
143 (void)reinterpret_cast<DA &>(ra); in reinterpret_reference_downcast()
144 (void)reinterpret_cast<const DA &>(ra); in reinterpret_reference_downcast()
145 (void)reinterpret_cast<volatile DA &>(ra); in reinterpret_reference_downcast()
146 (void)reinterpret_cast<const volatile DA &>(ra); in reinterpret_reference_downcast()
148 (void)reinterpret_cast<const DA &>(cra); in reinterpret_reference_downcast()
149 (void)reinterpret_cast<const volatile DA &>(cra); in reinterpret_reference_downcast()
154 …// expected-warning@+2 {{'reinterpret_cast' to class 'DVA &' from its virtual base 'A' behaves dif… in reinterpret_reference_downcast()
155 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in reinterpret_reference_downcast()
157 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_downcast()
159 …// expected-warning@+2 {{'reinterpret_cast' to class 'DDVA &' from its virtual base 'A' behaves di… in reinterpret_reference_downcast()
160 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in reinterpret_reference_downcast()
162 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_downcast()
164 …// expected-warning@+2 {{'reinterpret_cast' to class 'DMA &' from its virtual base 'A' behaves dif… in reinterpret_reference_downcast()
165 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in reinterpret_reference_downcast()
167 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_downcast()
170 void reinterpret_pointer_upcast(DA *da, const DA *cda, DDA *dda, DAo *dao, in reinterpret_pointer_upcast() argument
172 (void)*reinterpret_cast<A *>(da); in reinterpret_pointer_upcast()
173 (void)*reinterpret_cast<const A *>(da); in reinterpret_pointer_upcast()
174 (void)*reinterpret_cast<volatile A *>(da); in reinterpret_pointer_upcast()
175 (void)*reinterpret_cast<const volatile A *>(da); in reinterpret_pointer_upcast()
181 (void)*reinterpret_cast<DA *>(dda); in reinterpret_pointer_upcast()
184 …// expected-warning@+2 {{'reinterpret_cast' from class 'DVA *' to its virtual base 'A *' behaves d… in reinterpret_pointer_upcast()
185 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_pointer_upcast()
187 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_upcast()
189 …// expected-warning@+2 {{'reinterpret_cast' from class 'DDVA *' to its virtual base 'A *' behaves … in reinterpret_pointer_upcast()
190 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_pointer_upcast()
192 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_upcast()
194 …// expected-warning@+2 {{'reinterpret_cast' from class 'DDVA *' to its virtual base 'DA *' behaves… in reinterpret_pointer_upcast()
195 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_pointer_upcast()
196 (void)*reinterpret_cast<DA *>(ddva); in reinterpret_pointer_upcast()
197 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_upcast()
199 …// expected-warning@+2 {{'reinterpret_cast' from class 'DMA *' to its virtual base 'A *' behaves d… in reinterpret_pointer_upcast()
200 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_pointer_upcast()
202 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_upcast()
204 …// expected-warning@+2 {{'reinterpret_cast' from class 'DMA *' to its virtual base 'DA *' behaves … in reinterpret_pointer_upcast()
205 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_pointer_upcast()
206 (void)*reinterpret_cast<DA *>(dma); in reinterpret_pointer_upcast()
207 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:26}:"static_cast" in reinterpret_pointer_upcast()
210 void reinterpret_reference_upcast(DA &da, const DA &cda, DDA &dda, DAo &dao, in reinterpret_reference_upcast() argument
212 (void)reinterpret_cast<A &>(da); in reinterpret_reference_upcast()
213 (void)reinterpret_cast<const A &>(da); in reinterpret_reference_upcast()
214 (void)reinterpret_cast<volatile A &>(da); in reinterpret_reference_upcast()
215 (void)reinterpret_cast<const volatile A &>(da); in reinterpret_reference_upcast()
221 (void)reinterpret_cast<DA &>(dda); in reinterpret_reference_upcast()
224 …// expected-warning@+2 {{'reinterpret_cast' from class 'DVA' to its virtual base 'A &' behaves dif… in reinterpret_reference_upcast()
225 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_reference_upcast()
227 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_upcast()
229 …// expected-warning@+2 {{'reinterpret_cast' from class 'DDVA' to its virtual base 'A &' behaves di… in reinterpret_reference_upcast()
230 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_reference_upcast()
232 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_upcast()
234 …// expected-warning@+2 {{'reinterpret_cast' from class 'DDVA' to its virtual base 'DA &' behaves d… in reinterpret_reference_upcast()
235 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_reference_upcast()
236 (void)reinterpret_cast<DA &>(ddva); in reinterpret_reference_upcast()
237 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_upcast()
239 …// expected-warning@+2 {{'reinterpret_cast' from class 'DMA' to its virtual base 'A &' behaves dif… in reinterpret_reference_upcast()
240 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_reference_upcast()
242 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_upcast()
244 …// expected-warning@+2 {{'reinterpret_cast' from class 'DMA' to its virtual base 'DA &' behaves di… in reinterpret_reference_upcast()
245 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in reinterpret_reference_upcast()
246 (void)reinterpret_cast<DA &>(dma); in reinterpret_reference_upcast()
247 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in reinterpret_reference_upcast()
254 class F : public E { class
258 class G : public F {
264 class I : virtual public F {
267 typedef const F * K;
270 void different_subobject_downcast(E *e, F *f, A *a) { in different_subobject_downcast() argument
271 …// expected-warning@+2 {{'reinterpret_cast' to class 'F *' from its base at non-zero offset 'E *' … in different_subobject_downcast()
272 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in different_subobject_downcast()
273 (void)reinterpret_cast<F *>(e); in different_subobject_downcast()
274 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_downcast()
276 …// expected-warning@+2 {{'reinterpret_cast' to class 'G *' from its base at non-zero offset 'E *' … in different_subobject_downcast()
277 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in different_subobject_downcast()
279 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_downcast()
282 …// expected-warning@+2 {{'reinterpret_cast' to class 'I *' from its virtual base 'E *' behaves dif… in different_subobject_downcast()
283 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in different_subobject_downcast()
285 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_downcast()
288 (void)reinterpret_cast<G *>(f); in different_subobject_downcast()
289 …// expected-warning@+2 {{'reinterpret_cast' to class 'I *' from its virtual base 'F *' behaves dif… in different_subobject_downcast()
290 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in different_subobject_downcast()
291 (void)reinterpret_cast<I *>(f); in different_subobject_downcast()
292 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_downcast()
295 // In MS ABI mode, A is at non-zero offset in H. in different_subobject_downcast()
296 …// expected-warning@+3 {{'reinterpret_cast' to class 'H *' from its base at non-zero offset 'A *' … in different_subobject_downcast()
297 // expected-note@+2 {{use 'static_cast'}} in different_subobject_downcast()
301 …// expected-warning@+2 {{'reinterpret_cast' to class 'L' (aka 'const F *volatile') from its base a… in different_subobject_downcast()
302 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while downcasting}} in different_subobject_downcast()
304 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_downcast()
307 void different_subobject_upcast(F *f, G *g, H *h, I *i) { in different_subobject_upcast() argument
308 …// expected-warning@+2 {{'reinterpret_cast' from class 'F *' to its base at non-zero offset 'E *' … in different_subobject_upcast()
309 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in different_subobject_upcast()
310 (void)reinterpret_cast<E *>(f); in different_subobject_upcast()
311 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_upcast()
313 (void)reinterpret_cast<F *>(g); in different_subobject_upcast()
314 …// expected-warning@+2 {{'reinterpret_cast' from class 'G *' to its base at non-zero offset 'E *' … in different_subobject_upcast()
315 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in different_subobject_upcast()
317 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_upcast()
322 // In MS ABI mode, A is at non-zero offset in H. in different_subobject_upcast()
323 …// expected-warning@+3 {{'reinterpret_cast' from class 'H *' to its base at non-zero offset 'A *' … in different_subobject_upcast()
324 // expected-note@+2 {{use 'static_cast'}} in different_subobject_upcast()
328 …// expected-warning@+2 {{'reinterpret_cast' from class 'I *' to its virtual base 'F *' behaves dif… in different_subobject_upcast()
329 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in different_subobject_upcast()
330 (void)reinterpret_cast<F *>(i); in different_subobject_upcast()
331 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_upcast()
333 …// expected-warning@+2 {{'reinterpret_cast' from class 'I *' to its virtual base 'E *' behaves dif… in different_subobject_upcast()
334 // expected-note@+1 {{use 'static_cast' to adjust the pointer correctly while upcasting}} in different_subobject_upcast()
336 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:25}:"static_cast" in different_subobject_upcast()