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
564
564
the invalid attribute location appropriately. (#GH137861)
565
565
- Fixed a crash when a malformed ``_Pragma `` directive appears as part of an
566
566
``#include `` directive. (#GH138094)
567
+ - Fixed a crash during constant evaluation involving invalid lambda captures
568
+ (#GH138832)
567
569
568
570
Bug Fixes to Compiler Builtins
569
571
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -2932,10 +2932,9 @@ bool Compiler<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
2932
2932
// record with their initializers.
2933
2933
for (const Record::Field &F : R->fields ()) {
2934
2934
const Expr *Init = *CaptureInitIt;
2935
- ++CaptureInitIt;
2936
-
2937
- if (!Init)
2935
+ if (!Init || Init->containsErrors ())
2938
2936
continue ;
2937
+ ++CaptureInitIt;
2939
2938
2940
2939
if (std::optional<PrimType> T = classify (Init)) {
2941
2940
if (!this ->visit (Init))
Original file line number Diff line number Diff line change @@ -11038,7 +11038,7 @@ bool RecordExprEvaluator::VisitLambdaExpr(const LambdaExpr *E) {
11038
11038
11039
11039
// If there is no initializer, either this is a VLA or an error has
11040
11040
// occurred.
11041
- if (!CurFieldInit)
11041
+ if (!CurFieldInit || CurFieldInit->containsErrors() )
11042
11042
return Error(E);
11043
11043
11044
11044
LValue Subobject = This;
Original file line number Diff line number Diff line change @@ -2598,3 +2598,12 @@ void foo() {
2598
2598
constexpr S s[2 ] = { }; // expected-error {{constexpr variable 's' must be initialized by a constant expression}}
2599
2599
}
2600
2600
}
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