File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -564,6 +564,8 @@ Bug Fixes in This Version
564564 the invalid attribute location appropriately. (#GH137861)
565565- Fixed a crash when a malformed ``_Pragma `` directive appears as part of an
566566 ``#include `` directive. (#GH138094)
567+ - Fixed a crash during constant evaluation involving invalid lambda captures
568+ (#GH138832)
567569
568570Bug Fixes to Compiler Builtins
569571^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -2932,10 +2932,9 @@ bool Compiler<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
29322932 // record with their initializers.
29332933 for (const Record::Field &F : R->fields ()) {
29342934 const Expr *Init = *CaptureInitIt;
2935- ++CaptureInitIt;
2936-
2937- if (!Init)
2935+ if (!Init || Init->containsErrors ())
29382936 continue ;
2937+ ++CaptureInitIt;
29392938
29402939 if (std::optional<PrimType> T = classify (Init)) {
29412940 if (!this ->visit (Init))
Original file line number Diff line number Diff line change @@ -11038,7 +11038,7 @@ bool RecordExprEvaluator::VisitLambdaExpr(const LambdaExpr *E) {
1103811038
1103911039 // If there is no initializer, either this is a VLA or an error has
1104011040 // occurred.
11041- if (!CurFieldInit)
11041+ if (!CurFieldInit || CurFieldInit->containsErrors() )
1104211042 return Error(E);
1104311043
1104411044 LValue Subobject = This;
Original file line number Diff line number Diff line change @@ -2598,3 +2598,12 @@ void foo() {
25982598 constexpr S s[2 ] = { }; // expected-error {{constexpr variable 's' must be initialized by a constant expression}}
25992599}
26002600}
2601+
2602+ namespace DoubleCapture {
2603+ int DC () {
2604+ int a = 1000 ;
2605+ static auto f =
2606+ [a, &a] { // expected-error {{'a' can appear only once in a capture list}}
2607+ };
2608+ }
2609+ }
You can’t perform that action at this time.
0 commit comments