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