[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / pr18806.cpp
blob28ceb82ca5a5546c0db3b2177f1876d8a740f6b9
1 // RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s
2 // RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s
4 // RUN: %clang_cc1 -std=c++11 -emit-pch -fpch-instantiate-templates -o %t %s
5 // RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s
7 // expected-no-diagnostics
9 // Before the patch, this test triggered an assert violation in
10 // ASTContext::getSubstTemplateTypeParmType.
12 #ifndef HEADER_INCLUDED
13 #define HEADER_INCLUDED
15 template <typename T>
16 using Id = T;
18 template <typename X>
19 struct Class1 {
20 template <typename Y, typename = decltype(Y())>
21 struct Nested1;
24 template <typename A>
25 struct Class2 {
26 template <typename B, typename = Id<decltype(B())>>
27 struct Nested2;
30 #else
32 Class2<char> test;
34 #endif