File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -2749,10 +2749,9 @@ bool ByteCodeExprGen<Emitter>::visitVarDecl(const VarDecl *VD) {
2749
2749
return this ->emitSetLocal (*VarT, Offset, VD);
2750
2750
}
2751
2751
} else {
2752
- if (std::optional<unsigned > Offset = this ->allocateLocal (VD)) {
2753
- if (Init)
2754
- return this ->visitLocalInitializer (Init, *Offset);
2755
- }
2752
+ if (std::optional<unsigned > Offset = this ->allocateLocal (VD))
2753
+ return !Init || this ->visitLocalInitializer (Init, *Offset);
2754
+ return false ;
2756
2755
}
2757
2756
return true ;
2758
2757
}
Original file line number Diff line number Diff line change @@ -545,3 +545,22 @@ namespace LocalIndex {
545
545
array[const_subscript] = 0 ; // both-warning {{array index 3 is past the end of the array (that has type 'int[2]')}}
546
546
}
547
547
}
548
+
549
+ namespace LocalVLA {
550
+ struct Foo {
551
+ int x;
552
+ Foo (int x) : x(x) {}
553
+ };
554
+ struct Elidable {
555
+ Elidable ();
556
+ };
557
+
558
+ void foo (int size) {
559
+ Elidable elidableDynArray[size];
560
+ #if __cplusplus >= 202002L
561
+ // both-note@-3 {{declared here}}
562
+ // both-warning@-3 {{variable length array}}
563
+ // both-note@-4 {{function parameter 'size' with unknown value}}
564
+ #endif
565
+ }
566
+ }
You can’t perform that action at this time.
0 commit comments