[clang] [Clang][Sema] fix crash in codegen stage when an lambda expression declared in an unevaluated context (PR #80802)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 18:11:51 PST 2024


================
@@ -1613,8 +1613,8 @@ namespace {
 bool TemplateInstantiator::AlreadyTransformed(QualType T) {
   if (T.isNull())
     return true;
-
-  if (T->isInstantiationDependentType() || T->isVariablyModifiedType())
+  if (T->isInstantiationDependentType() || T->isVariablyModifiedType() ||
+      (SemaRef.getLangOpts().CPlusPlus20 && T->isDecltypeType()))
----------------
jcsxky wrote:

> Can you please add the relevant standards-quote here, particularly for the C++20 vs pre-C++20 change here?

Sorry, I couldn't get what you mean of  relevant standards-quote and I am not very familiar with cpp standards. I add `SemaRef.getLangOpts().CPlusPlus20` just because command args contains `-std=c++20` and clang diagnose says 'lambda expression in an unevaluated operand' and don't retransform `decltype` all the time(issue only exists in code of cpp20 and later).

https://github.com/llvm/llvm-project/pull/80802


More information about the cfe-commits mailing list