48 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3struct B1 {4 void f();5 static void f(int);6 int i; // expected-note 2{{member found by ambiguous name lookup}}7};8struct B2 {9 void f(double);10};11struct I1: B1 { };12struct I2: B1 { };13 14struct D: I1, I2, B2 {15 using B1::f;16 using B2::f;17 void g() {18 f(); // expected-error {{ambiguous conversion from derived class 'D' to base class 'B1'}}19 f(0); // ok20 f(0.0); // ok21 // FIXME next line should be well-formed22 int B1::* mpB1 = &D::i; // expected-error {{non-static member 'i' found in multiple base-class subobjects of type 'B1'}}23 int D::* mpD = &D::i; // expected-error {{non-static member 'i' found in multiple base-class subobjects of type 'B1'}}24 }25};26 27namespace GH80435 {28struct A {29 void *data; // expected-note {{member found by ambiguous name lookup}}30};31 32class B {33 void *data; // expected-note {{member found by ambiguous name lookup}}34};35 36struct C : A, B {};37 38decltype(C().data) x; // expected-error {{member 'data' found in multiple base classes of different types}}39 40struct D { // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'C' to 'const D' for 1st argument}}41 // expected-note@-1{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'C' to 'D' for 1st argument}}42 template <typename Container, decltype(Container().data) = 0 >43 D(Container); // expected-note {{candidate template ignored: substitution failure [with Container = C]: member 'data' found in multiple base classes of different types}}44};45 46D y(C{}); // expected-error {{no matching constructor for initialization of 'D'}}47}48