[clang] af97139 - [clang][Interp] Handle missing Lambda field initializer
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 26 04:17:09 PST 2024
Author: Timm Bäder
Date: 2024-02-26T13:16:35+01:00
New Revision: af971396a9c77a57eb66fcb7eac3f671a7084680
URL: https://github.com/llvm/llvm-project/commit/af971396a9c77a57eb66fcb7eac3f671a7084680
DIFF: https://github.com/llvm/llvm-project/commit/af971396a9c77a57eb66fcb7eac3f671a7084680.diff
LOG: [clang][Interp] Handle missing Lambda field initializer
Added:
Modified:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index b5402ec8caaec6..e96afb1078cc79 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1731,6 +1731,9 @@ bool ByteCodeExprGen<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
const Expr *Init = *CaptureInitIt;
++CaptureInitIt;
+ if (!Init)
+ continue;
+
if (std::optional<PrimType> T = classify(Init)) {
if (!this->visit(Init))
return false;
diff --git a/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp b/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
index 95bc32b603ddf0..45b78139d0b018 100644
--- a/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
+++ b/clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
@@ -3,6 +3,11 @@
// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s -DMS_EXTENSIONS
// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s -DMS_EXTENSIONS -DDELAYED_TEMPLATE_PARSING
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -emit-llvm-only %s -fexperimental-new-constant-interpreter
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s -DDELAYED_TEMPLATE_PARSING -fexperimental-new-constant-interpreter
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s -DMS_EXTENSIONS -fexperimental-new-constant-interpreter
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s -DMS_EXTENSIONS -DDELAYED_TEMPLATE_PARSING -fexperimental-new-constant-interpreter
+
template <class, class>
constexpr bool is_same = false;
template <class T>
More information about the cfe-commits
mailing list