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