[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / PR62533.cpp
blob0753156813f8e735e255b0c753428cc3c4199205
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 template<typename T>
4 struct test {
5 template<typename> using fun_diff = char; // expected-note 2{{type alias template declared here}}
6 };
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>::fun_diff' is expected to be a non-type template, but instantiated to a type alias template}}
12 template<typename T>
13 void foo2() {
14 // expected-error@+1 {{test<int>::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>;
18 template<typename T, typename V>
19 struct has_fun_diff {
20 using type = double;
23 template<typename T>
24 struct has_fun_diff<T, int> {
25 // expected-error@+1 {{'test<int>::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>);
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}}