llvm-project/clang/test/CodeGenCXX/cxx20-unevaluated-lambda-crash.cpp
Liming Liu 051cc460ba [C++20] Determine the dependency of unevaluated lambdas more accurately
During template instantiation, the instantiator will enter constant
evaluated
context before instantiate a template argument originated from an
expression,
and this impedes the instantiator from creating lambdas with independent
types.

This patch solves the problem via widening the condition that the
instantiator
marks lambdas as never dependent, and fixes the issue #57960

Differential Revision: https://reviews.llvm.org/D140554
2023-01-06 05:56:25 -08:00

15 lines
317 B
C++

// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 %s -emit-llvm -o - | FileCheck %s
// CHECK-LABEL: define linkonce_odr void @"_ZN10Issue579601EIiEENS_1FILNS_3$_0EEEEv"()
namespace Issue57960 {
template<auto>
class F {};
template<typename D>
F<[]{}> E() {
return {};
}
static auto f = E<int>();
}