| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
template<typename T> |
| 4 |
struct test { |
| 5 |
template<typename> using fun_diff = char; // expected-note 2{{type alias template declared here}} |
| 6 |
}; |
| 7 |
|
| 8 |
template<typename T, typename V> |
| 9 |
decltype(T::template fun_diff<V>) foo1() {} |
| 10 |
// expected-note@-1 {{candidate template ignored: substitution failure [with T = test<int>, V = int]: 'test<int>::template fun_diff' is expected to be a non-type template, but instantiated to a type alias template}} |
| 11 |
|
| 12 |
template<typename T> |
| 13 |
void foo2() { |
| 14 |
// expected-error@+1 {{test<int>::template fun_diff' is expected to be a non-type template, but instantiated to a type alias template}} |
| 15 |
int a = test<T>::template fun_diff<int>; |
| 16 |
} |
| 17 |
|
| 18 |
template<typename T, typename V> |
| 19 |
struct has_fun_diff { |
| 20 |
using type = double; |
| 21 |
}; |
| 22 |
|
| 23 |
template<typename T> |
| 24 |
struct has_fun_diff<T, int> { |
| 25 |
// expected-error@+1 {{'test<int>::template fun_diff' is expected to be a non-type template, but instantiated to a type alias template}} |
| 26 |
using type = decltype(T::template fun_diff<int>); |
| 27 |
}; |
| 28 |
|
| 29 |
void bar() { |
| 30 |
foo1<test<int>, int>(); // expected-error {{no matching function for call to 'foo1'}} |
| 31 |
foo2<int>(); // expected-note {{in instantiation of function template specialization}} |
| 32 |
has_fun_diff<test<int>, int>::type a; // expected-note {{in instantiation of template class}} |
| 33 |
} |