1 | // RUN: %clang_cc1 -verify %s -std=c++11 |
2 | |
3 | template<typename T> struct A { |
4 | template<typename U> struct B; |
5 | template<typename U> using C = U; // expected-note {{here}} |
6 | }; |
7 | |
8 | struct X { |
9 | template<typename T> X(T); |
10 | struct Y { |
11 | template<typename T> Y(T); |
12 | }; |
13 | }; |
14 | |
15 | template<typename T> A // expected-error {{missing 'typename' prior to dependent type template name 'A<T>::B'}} |
16 | <T>::B<T> f1(); |
17 | template<typename T> A<T>::C<T> f2(); // expected-error {{missing 'typename' prior to dependent type template name 'A<T>::C'}} |
18 | |
19 | // FIXME: Should these cases really be valid? There doesn't appear to be a rule prohibiting them... |
20 | template<typename T> A<T>::C<X>::X(T) {} |
21 | template<typename T> A<T>::C<X>::X::Y::Y(T) {} |
22 | |
23 | // FIXME: This is ill-formed |
24 | template<typename T> int A<T>::B<T>::*f3() {} |
25 | template<typename T> int A<T>::C<X>::*f4() {} |
26 | |
27 | // FIXME: This is valid |
28 | template<typename T> int A<T>::template C<int>::*f5() {} // expected-error {{has no members}} |
29 | |
30 | template<typename T> template<typename U> struct A<T>::B { |
31 | friend A<T>::C<T> f6(); // ok, same as 'friend T f6();' |
32 | |
33 | // FIXME: Error recovery here is awful; we decide that the template-id names |
34 | // a type, and then complain about the rest of the tokens, and then complain |
35 | // that we didn't get a function declaration. |
36 | friend A<U>::C<T> f7(); // expected-error {{use 'template' keyword to treat 'C' as a dependent template name}} expected-error 3{{}} |
37 | friend A<U>::template C<T> f8(); // expected-error 4{{}} |
38 | }; |
39 | |