1 // RUN: %clang_cc1 %s -emit-llvm-only -triple=i386-pc-win32 -verify -DTEST1
2 // RUN: %clang_cc1 %s -emit-llvm-only -triple=i386-pc-win32 -verify -DTEST2
3
4 #ifdef TEST1
5 struct A {
6 virtual A *foo(); // in vftable slot #0.
7 virtual A *bar(); // in vftable slot #1.
8 };
9
10 struct B : virtual A {
11 // appended to the A subobject's vftable in slot #2.
12 virtual B *foo(); // expected-note{{covariant thunk required by 'foo'}}
13 };
14
15 struct C : virtual A {
16 // appended to the A subobject's vftable in slot #2.
17 virtual C *bar(); // expected-note{{covariant thunk required by 'bar'}}
18 };
19
20 struct D : B, C { D(); }; // expected-error{{ambiguous vftable component}}
D()21 D::D() {}
22 #endif
23
24 #ifdef TEST2
25 struct A {
26 virtual A *foo(); // in vftable slot #0
27 };
28
29 struct B : virtual A {
30 // appended to the A subobject's vftable in slot #1.
31 virtual B *foo(); // expected-note{{covariant thunk required by 'foo'}}
32 };
33
34 struct C : virtual A {
35 // appended to the A subobject's vftable in slot #1.
36 virtual C *foo(); // expected-note{{covariant thunk required by 'foo'}}
37 };
38
39 struct D : B, C { // expected-error{{ambiguous vftable component}}
40 virtual D *foo();
41 D();
42 };
D()43 D::D() {}
44 #endif
45