brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 6b55f14 Raw
52 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -DMS -fms-compatibility -Wmicrosoft-inaccessible-base -fsyntax-only -verify %s3 4struct A {5  int a;6};7 8struct X1 : virtual A9{};10 11struct Y1 : X1, virtual A12{};13 14struct Y2 : X1, A // expected-warning{{direct base 'A' is inaccessible due to ambiguity:\n    struct Y2 -> X1 -> A\n    struct Y2 -> A}}15{};16 17struct X2 : A18{};19 20struct Z1 : X2, virtual A // expected-warning{{direct base 'A' is inaccessible due to ambiguity:\n    struct Z1 -> X2 -> A\n    struct Z1 -> A}}21{};22 23struct Z2 : X2, A // expected-warning{{direct base 'A' is inaccessible due to ambiguity:\n    struct Z2 -> X2 -> A\n    struct Z2 -> A}}24{};25 26A *y2_to_a(Y2 *p) {27#ifdef MS28  // expected-warning@+4 {{accessing inaccessible direct base 'A' of 'Y2' is a Microsoft extension}}29#else30  // expected-error@+2 {{ambiguous conversion}}31#endif32  return p;33}34 35A *z1_to_a(Z1 *p) {36#ifdef MS37  // expected-warning@+4 {{accessing inaccessible direct base 'A' of 'Z1' is a Microsoft extension}}38#else39  // expected-error@+2 {{ambiguous conversion}}40#endif41  return p;42}43 44A *z1_to_a(Z2 *p) {45#ifdef MS46  // expected-warning@+4 {{accessing inaccessible direct base 'A' of 'Z2' is a Microsoft extension}}47#else48  // expected-error@+2 {{ambiguous conversion}}49#endif50  return p;51}52