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
8template<a>
9struct int_;
10
11template<a>
12template<int,typename T1,typename>
13struct ac
14{
15  typedef T1 ae
16};
17
18template<class>struct aaa
19{
20  typedef ac<1,int,int>::ae ae
21};
22
23template<class>
24struct 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
55int a()
56{
57  state_machine<int> p;
58  p.ant(0);
59}
60
61// PR9974
62template <int> struct enable_if;
63template <class > struct remove_reference ;
64template <class _Tp> struct remove_reference<_Tp&> ;
65
66template <class > struct __tuple_like;
67
68template <class _Tp, class _Up, int = __tuple_like<typename remove_reference<_Tp>::type>::value>
69struct __tuple_convertible;
70
71struct pair
72{
73template<class _Tuple, int = enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
74pair(_Tuple&& );
75};
76
77template <class> struct basic_ostream;
78
79template <int>
80void endl( ) ;
81
82extern basic_ostream<char> cout;
83
84int operator<<( basic_ostream<char> , pair ) ;
85
86void register_object_imp ( )
87{
88cout << endl<1>;
89}
90
91// PR12933
92namespacae 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
104namespace 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
114namespace 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
124namespace 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
135namespace 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