1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 // FIXME: Access control checks 4 5 namespace PR5820 { 6 // also <rdar://problem/7535045> 7 struct Base { 8 void Foo(); 9 int Member; 10 }; 11 12 struct D1 : public Base {}; 13 struct D2 : public Base {}; 14 15 struct Derived : public D1, public D2 { 16 void Inner(); 17 }; 18 Test()19 void Test() { 20 Derived d; 21 d.D1::Foo(); 22 d.D1::Member = 17; 23 } 24 Inner()25 void Derived::Inner() { 26 D1::Foo(); 27 D1::Member = 42; 28 this->D1::Foo(); 29 this->D1::Member = 42; 30 } 31 } 32 33 template<typename T> 34 struct BaseT { 35 void Foo(); // expected-note{{found by ambiguous name lookup}} 36 int Member; 37 }; 38 39 template<typename T> struct Derived1T : BaseT<T> { }; 40 template<typename T> struct Derived2T : BaseT<T> { }; 41 42 template<typename T> 43 struct DerivedT : public Derived1T<T>, public Derived2T<T> { 44 void Inner(); 45 }; 46 47 template<typename T> Inner()48void DerivedT<T>::Inner() { 49 Derived1T<T>::Foo(); 50 Derived2T<T>::Member = 42; 51 this->Derived1T<T>::Foo(); 52 this->Derived2T<T>::Member = 42; 53 this->Foo(); // expected-error{{non-static member 'Foo' found in multiple base-class subobjects of type 'BaseT<int>'}} 54 } 55 56 template<typename T> Test(DerivedT<T> d)57void Test(DerivedT<T> d) { 58 d.template Derived1T<T>::Foo(); 59 d.template Derived2T<T>::Member = 17; 60 d.Inner(); // expected-note{{in instantiation}} 61 } 62 63 template void Test(DerivedT<int>); 64