1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc template<class X> struct A {}; 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc template<class X> struct B : A<X> { BB6*f4a2713aSLionel Sambuc B() : A<X>() {} 7*f4a2713aSLionel Sambuc }; 8*f4a2713aSLionel Sambuc B<int> x; 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc template<class X> struct B1 : A<X> { 11*f4a2713aSLionel Sambuc typedef A<X> Base; B1B112*f4a2713aSLionel Sambuc B1() : Base() {} 13*f4a2713aSLionel Sambuc }; 14*f4a2713aSLionel Sambuc B1<int> x1; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc template<typename T> struct Tmpl { }; 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc template<typename T> struct TmplB { }; 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc struct TmplC : Tmpl<int> { TmplCTmplC22*f4a2713aSLionel Sambuc TmplC() : 23*f4a2713aSLionel Sambuc Tmpl<int>(), 24*f4a2713aSLionel Sambuc TmplB<int>() { } // expected-error {{type 'TmplB<int>' is not a direct or virtual base of 'TmplC'}} 25*f4a2713aSLionel Sambuc }; 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc struct TmplD : Tmpl<char>, TmplB<char> { TmplDTmplD29*f4a2713aSLionel Sambuc TmplD(): 30*f4a2713aSLionel Sambuc Tmpl<int>(), // expected-error {{type 'Tmpl<int>' is not a direct or virtual base of 'TmplD'}} 31*f4a2713aSLionel Sambuc TmplB<char>() {} 32*f4a2713aSLionel Sambuc }; 33*f4a2713aSLionel Sambuc 34*f4a2713aSLionel Sambuc namespace PR7259 { 35*f4a2713aSLionel Sambuc class Base { 36*f4a2713aSLionel Sambuc public: Base()37*f4a2713aSLionel Sambuc Base() {} 38*f4a2713aSLionel Sambuc }; 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc template <class ParentClass> 41*f4a2713aSLionel Sambuc class Derived : public ParentClass { 42*f4a2713aSLionel Sambuc public: Derived()43*f4a2713aSLionel Sambuc Derived() : Base() {} 44*f4a2713aSLionel Sambuc }; 45*f4a2713aSLionel Sambuc 46*f4a2713aSLionel Sambuc class Final : public Derived<Base> { 47*f4a2713aSLionel Sambuc }; 48*f4a2713aSLionel Sambuc 49*f4a2713aSLionel Sambuc int main(void)50*f4a2713aSLionel Sambuc main (void) 51*f4a2713aSLionel Sambuc { 52*f4a2713aSLionel Sambuc Final final; 53*f4a2713aSLionel Sambuc return 0; 54*f4a2713aSLionel Sambuc } 55*f4a2713aSLionel Sambuc } 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambuc namespace NonDependentError { 58*f4a2713aSLionel Sambuc struct Base { Base(int); }; // expected-note 2{{candidate}} 59*f4a2713aSLionel Sambuc 60*f4a2713aSLionel Sambuc template<typename T> 61*f4a2713aSLionel Sambuc struct Derived1 : Base { Derived1NonDependentError::Derived162*f4a2713aSLionel Sambuc Derived1() : Base(1, 2) {} // expected-error {{no matching constructor}} 63*f4a2713aSLionel Sambuc }; 64*f4a2713aSLionel Sambuc 65*f4a2713aSLionel Sambuc template<typename T> 66*f4a2713aSLionel Sambuc struct Derived2 : Base { Derived2NonDependentError::Derived267*f4a2713aSLionel Sambuc Derived2() : BaseClass(1) {} // expected-error {{does not name a non-static data member or base}} 68*f4a2713aSLionel Sambuc }; 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc Derived1<void> d1; 71*f4a2713aSLionel Sambuc Derived2<void> d2; 72*f4a2713aSLionel Sambuc } 73