llvm-project
llvm-project copied to clipboard
clang c++20: rejects code when using a immediately invoked lambda in a concept
template <class T>
concept always_true = []() { return true; }();
template <class T>
constexpr auto foo() requires(always_true<T>) { return true; }
static_assert(foo<int>());
https://godbolt.org/z/EebsTsz9o
@llvm/issue-subscribers-c-20
@llvm/issue-subscribers-clang-frontend
This is the same issue as a lot of other lambda related bugs.
We do not have a good way to know that we are not in a dependent context in TreeTransform::TransformLambdaExpr, so we incorrectly make the lambda type - which is created, rather than transformed - dependent, and that causes issues down the line.
This is fixed at head now.