File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2537,7 +2537,7 @@ inline bool ArrayDecay(InterpState &S, CodePtr OpPC) {
2537
2537
if (!CheckRange (S, OpPC, Ptr, CSK_ArrayToPointer))
2538
2538
return false ;
2539
2539
2540
- if (Ptr.isRoot () || !Ptr.isUnknownSizeArray () || Ptr. isDummy () ) {
2540
+ if (Ptr.isRoot () || !Ptr.isUnknownSizeArray ()) {
2541
2541
S.Stk .push <Pointer>(Ptr.atIndex (0 ));
2542
2542
return true ;
2543
2543
}
Original file line number Diff line number Diff line change @@ -436,6 +436,15 @@ namespace Incomplete {
436
436
constexpr int C = *F.a; // both-error {{must be initialized by a constant expression}} \
437
437
// both-note {{array-to-pointer decay of array member without known bound}}
438
438
439
+ struct X {
440
+ int a;
441
+ int b[];
442
+ };
443
+ extern X x;
444
+ constexpr int *xb = x.b; // both-error {{must be initialized by a constant expression}} \
445
+ // both-note {{array-to-pointer decay of array member without known bound}}
446
+
447
+
439
448
// / These are from test/SemaCXX/constant-expression-cxx11.cpp
440
449
extern int arr[];
441
450
constexpr int *c = &arr[1 ]; // both-error {{must be initialized by a constant expression}} \
You can’t perform that action at this time.
0 commit comments