1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | // RUN: %clang_cc1 -DMS -fms-compatibility -Wmicrosoft-inaccessible-base -fsyntax-only -verify %s |
3 | |
4 | struct A { |
5 | int a; |
6 | }; |
7 | |
8 | struct X1 : virtual A |
9 | {}; |
10 | |
11 | struct Y1 : X1, virtual A |
12 | {}; |
13 | |
14 | struct Y2 : X1, A // expected-warning{{direct base 'A' is inaccessible due to ambiguity:\n struct Y2 -> struct X1 -> struct A\n struct Y2 -> struct A}} |
15 | {}; |
16 | |
17 | struct X2 : A |
18 | {}; |
19 | |
20 | struct Z1 : X2, virtual A // expected-warning{{direct base 'A' is inaccessible due to ambiguity:\n struct Z1 -> struct X2 -> struct A\n struct Z1 -> struct A}} |
21 | {}; |
22 | |
23 | struct Z2 : X2, A // expected-warning{{direct base 'A' is inaccessible due to ambiguity:\n struct Z2 -> struct X2 -> struct A\n struct Z2 -> struct A}} |
24 | {}; |
25 | |
26 | A *y2_to_a(Y2 *p) { |
27 | #ifdef MS |
28 | // expected-warning@+4 {{accessing inaccessible direct base 'A' of 'Y2' is a Microsoft extension}} |
29 | #else |
30 | // expected-error@+2 {{ambiguous conversion}} |
31 | #endif |
32 | return p; |
33 | } |
34 | |
35 | A *z1_to_a(Z1 *p) { |
36 | #ifdef MS |
37 | // expected-warning@+4 {{accessing inaccessible direct base 'A' of 'Z1' is a Microsoft extension}} |
38 | #else |
39 | // expected-error@+2 {{ambiguous conversion}} |
40 | #endif |
41 | return p; |
42 | } |
43 | |
44 | A *z1_to_a(Z2 *p) { |
45 | #ifdef MS |
46 | // expected-warning@+4 {{accessing inaccessible direct base 'A' of 'Z2' is a Microsoft extension}} |
47 | #else |
48 | // expected-error@+2 {{ambiguous conversion}} |
49 | #endif |
50 | return p; |
51 | } |
52 | |