llvm-project/clang/test/Sema/PR85343.cpp
Qizhi Hu f5f3d5d653
[Clang][Sema] Fix a crash in lambda instantiation (#85565)
Fix https://github.com/llvm/llvm-project/issues/85343
When build lambda expression in lambda instantiation, `ThisType` is
required in `Sema::CheckCXXThisCapture` to build `this` capture. Set
`this` type by import `Sema::CXXThisScopeRAII` and it will be used later
in lambda expression transformation.

Co-authored-by: huqizhi <836744285@qq.com>
2024-03-20 08:33:30 +08:00

23 lines
404 B
C++

// RUN: %clang_cc1 -std=c++14 -verify %s
// expected-no-diagnostics
template <typename c> auto ab() -> c ;
template <typename> struct e {};
template <typename f> struct ac {
template <typename h> static e<decltype(ab<h>()(ab<int>))> i;
decltype(i<f>) j;
};
struct d {
template <typename f>
d(f) {
ac<f> a;
}
};
struct a {
d b = [=](auto) { (void)[this] {}; };
};
void b() { new a; }