blob: 3c01f6586b016680a69349a8c1d8e808b9ad664f [file] [log] [blame]
Douglas Gregor1fd6d442010-05-21 23:18:07 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2template<typename T, typename U, int N>
3struct X {
4 void f(T* t) {
5 t->f0<U>(); // expected-error{{use 'template' keyword to treat 'f0' as a dependent template name}}
6 t->f0<int>(); // expected-error{{use 'template' keyword to treat 'f0' as a dependent template name}}
7
8 t->operator+<U const, 1>(); // expected-error{{use 'template' keyword to treat 'operator +' as a dependent template name}}
9 t->f1<int const, 2>(); // expected-error{{use 'template' keyword to treat 'f1' as a dependent template name}}
10
Douglas Gregord5ab9b02010-05-21 23:43:39 +000011 T::getAs<U>(); // expected-error{{use 'template' keyword to treat 'getAs' as a dependent template name}}
12 t->T::getAs<U>(); // expected-error{{use 'template' keyword to treat 'getAs' as a dependent template name}}
13
Douglas Gregor1fd6d442010-05-21 23:18:07 +000014 // FIXME: We can't recover from these yet
15 (*t).f2<N>(); // expected-error{{expected expression}}
16 (*t).f2<0>(); // expected-error{{expected expression}}
17 }
18};
Douglas Gregor087eb5a2011-03-04 18:53:13 +000019
20namespace PR9401 {
21 // From GCC PR c++/45558
22 template <typename S, typename T>
23 struct C
24 {
25 template <typename U>
26 struct B
27 {
28 template <typename W>
29 struct E
30 {
31 explicit E(const W &x) : w(x) {}
32 const W &w;
33 };
34 };
35 };
36
37 struct F;
38 template <typename X>
39 struct D
40 {
41 D() {}
42 };
43
44 const D<F> g;
45 template <typename S, typename T>
46 struct A
47 {
48 template <typename U>
49 struct B : C<S, T>::template B<U>
50 {
51 typedef typename C<S, T>::template B<U> V;
52 static const D<typename V::template E<D<F> > > a;
53 };
54 };
55
56 template <typename S, typename T>
57 template <typename U>
58 const D<typename C<S, T>::template B<U>::template E<D<F> > >
59 A<S, T>::B<U>::a = typename C<S, T>::template B<U>::template E<D<F> >(g);
60}