1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<typename T, typename U, int N>
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}}
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}}
11 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}}
14 // FIXME: We can't recover from these yet
15 (*t).f2<N>(); // expected-error{{expected expression}}
16 (*t).f2<0>(); // expected-error{{expected expression}}
20 struct MrsBadcrumble {
21 friend MrsBadcrumble operator<(void (*)(int), MrsBadcrumble);
22 friend void operator>(MrsBadcrumble, int);
25 template<int N, typename T> void f(T t) {
26 t.f<N>(0); // expected-error {{missing 'template' keyword prior to dependent template name 'f'}}
27 t.T::f<N>(0); // expected-error {{missing 'template' keyword prior to dependent template name 'f'}}
28 T::g<N>(0); // expected-error {{missing 'template' keyword prior to dependent template name 'g'}}
30 // Note: no diagnostic here, this is actually valid as a comparison between
31 // the decayed pointer to Y::g<> and mb!
36 template <int> void f(int);
37 template <int = 0> static void g(int); // expected-warning 0-1{{extension}}
39 void q() { void (*p)(int) = Y::g; }
40 template void f<0>(Y); // expected-note {{in instantiation of}}
43 // From GCC PR c++/45558
44 template <typename S, typename T>
53 explicit E(const W &x) : w(x) {}
67 template <typename S, typename T>
71 struct B : C<S, T>::template B<U>
73 typedef typename C<S, T>::template B<U> V;
74 static const D<typename V::template E<D<F> > > a;
78 template <typename S, typename T>
80 const D<typename C<S, T>::template B<U>::template E<D<F> > >
81 A<S, T>::B<U>::a = typename C<S, T>::template B<U>::template E<D<F> >(g);