34 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3template<typename T>4struct test {5 template<typename> using fun_diff = char; // expected-note 2{{type alias template declared here}}6};7 8template<typename T, typename V>9decltype(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 12template<typename T>13void 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 18template<typename T, typename V>19struct has_fun_diff {20 using type = double;21};22 23template<typename T>24struct 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 29void 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}34