Home | History | Annotate | Download | only in SemaTemplate
      1 // RUN: not %clang_cc1 -fsyntax-only %s -std=c++11 2>&1| FileCheck %s
      2 
      3 // Note that the error count below doesn't matter. We just want to
      4 // make sure that the parser doesn't crash.
      5 // CHECK: 16 errors
      6 
      7 // PR7511
      8 template<a>
      9 struct int_;
     10 
     11 template<a>
     12 template<int,typename T1,typename>
     13 struct ac
     14 {
     15   typedef T1 ae
     16 };
     17 
     18 template<class>struct aaa
     19 {
     20   typedef ac<1,int,int>::ae ae
     21 };
     22 
     23 template<class>
     24 struct state_machine
     25 {
     26   typedef aaa<int>::ae aaa;
     27   int start()
     28   {
     29     ant(0);
     30   }
     31 
     32   template<class>
     33   struct region_processing_helper
     34   {
     35     template<class,int=0>
     36     struct In;
     37 
     38     template<int my>
     39     struct In<a::int_<aaa::a>,my>;
     40 
     41     template<class Event>
     42     int process(Event)
     43     {
     44       In<a::int_<0> > a;
     45     }
     46   }
     47   template<class Event>
     48   int ant(Event)
     49   {
     50     region_processing_helper<int>* helper;
     51     helper->process(0)
     52   }
     53 };
     54 
     55 int a()
     56 {
     57   state_machine<int> p;
     58   p.ant(0);
     59 }
     60 
     61 // PR9974
     62 template <int> struct enable_if;
     63 template <class > struct remove_reference ;
     64 template <class _Tp> struct remove_reference<_Tp&> ;
     65 
     66 template <class > struct __tuple_like;
     67 
     68 template <class _Tp, class _Up, int = __tuple_like<typename remove_reference<_Tp>::type>::value>
     69 struct __tuple_convertible;
     70 
     71 struct pair
     72 {
     73 template<class _Tuple, int = enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
     74 pair(_Tuple&& );
     75 };
     76 
     77 template <class> struct basic_ostream;
     78 
     79 template <int>
     80 void endl( ) ;
     81 
     82 extern basic_ostream<char> cout;
     83 
     84 int operator<<( basic_ostream<char> , pair ) ;
     85 
     86 void register_object_imp ( )
     87 {
     88 cout << endl<1>;
     89 }
     90 
     91 // PR12933
     92 namespacae PR12933 {
     93   template<typename S>
     94     template<typename T>
     95     void function(S a, T b) {}
     96 
     97   int main() {
     98     function(0, 1);
     99     return 0;
    100   }
    101 }
    102 
    103 // A buildbot failure from libcxx
    104 namespace libcxx_test {
    105   template <class _Ptr, bool> struct __pointer_traits_element_type;
    106   template <class _Ptr> struct __pointer_traits_element_type<_Ptr, true>;
    107   template <template <class, class...> class _Sp, class _Tp, class ..._Args> struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true> {
    108     typedef char type;
    109   };
    110   template <class T> struct B {};
    111   __pointer_traits_element_type<B<int>, true>::type x;
    112 }
    113 
    114 namespace PR14281_part1 {
    115   template <class P, int> struct A;
    116   template <class P> struct A<P, 1>;
    117   template <template <class, int> class S, class T> struct A<S<T, 1>, 1> {
    118     typedef char type;
    119   };
    120   template <class T, int i> struct B {};
    121   A<B<int, 1>, 1>::type x;
    122 }
    123 
    124 namespace PR14281_part2 {
    125   typedef decltype(nullptr) nullptr_t;
    126   template <class P, nullptr_t> struct A;
    127   template <class P> struct A<P, nullptr>;
    128   template <template <class, nullptr_t> class S, class T> struct A<S<T, nullptr>, nullptr> {
    129     typedef char type;
    130   };
    131   template <class T, nullptr_t i> struct B {};
    132   A<B<int, nullptr>, nullptr>::type x;
    133 }
    134 
    135 namespace PR14281_part3 {
    136   extern int some_decl;
    137   template <class P, int*> struct A;
    138   template <class P> struct A<P, &some_decl>;
    139   template <template <class, int*> class S, class T> struct A<S<T, &some_decl>, &some_decl> {
    140     typedef char type;
    141   };
    142   template <class T, int* i> struct B {};
    143   A<B<int, &some_decl>, &some_decl>::type x;
    144 }
    145