1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc class A { }; 3*f4a2713aSLionel Sambuc class B : public A { }; 4*f4a2713aSLionel Sambuc class C : public A { }; 5*f4a2713aSLionel Sambuc class D : public B, public C { }; 6*f4a2713aSLionel Sambuc f(D * d)7*f4a2713aSLionel Sambucvoid f(D* d) { 8*f4a2713aSLionel Sambuc A* a; 9*f4a2713aSLionel Sambuc a = d; // expected-error{{ambiguous conversion from derived class 'D' to base class 'A':}} expected-error{{assigning to 'A *' from incompatible type 'D *'}} 10*f4a2713aSLionel Sambuc } 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc class Object2 { }; 13*f4a2713aSLionel Sambuc class A2 : public Object2 { }; 14*f4a2713aSLionel Sambuc class B2 : public virtual A2 { }; 15*f4a2713aSLionel Sambuc class C2 : virtual public A2 { }; 16*f4a2713aSLionel Sambuc class D2 : public B2, public C2 { }; 17*f4a2713aSLionel Sambuc class E2 : public D2, public C2, public virtual A2 { }; 18*f4a2713aSLionel Sambuc class F2 : public E2, public A2 { }; 19*f4a2713aSLionel Sambuc g(E2 * e2,F2 * f2)20*f4a2713aSLionel Sambucvoid g(E2* e2, F2* f2) { 21*f4a2713aSLionel Sambuc Object2* o2; 22*f4a2713aSLionel Sambuc o2 = e2; 23*f4a2713aSLionel Sambuc o2 = f2; // expected-error{{ambiguous conversion from derived class 'F2' to base class 'Object2':}} expected-error{{assigning to 'Object2 *' from incompatible type 'F2 *'}} 24*f4a2713aSLionel Sambuc } 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc // Test that ambiguous/inaccessibility checking does not trigger too 27*f4a2713aSLionel Sambuc // early, because it should not apply during overload resolution. 28*f4a2713aSLionel Sambuc void overload_okay(Object2*); 29*f4a2713aSLionel Sambuc void overload_okay(E2*); 30*f4a2713aSLionel Sambuc overload_call(F2 * f2)31*f4a2713aSLionel Sambucvoid overload_call(F2* f2) { 32*f4a2713aSLionel Sambuc overload_okay(f2); 33*f4a2713aSLionel Sambuc } 34