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) {
25372537 if (!CheckRange (S, OpPC, Ptr, CSK_ArrayToPointer))
25382538 return false ;
25392539
2540- if (Ptr.isRoot () || !Ptr.isUnknownSizeArray () || Ptr. isDummy () ) {
2540+ if (Ptr.isRoot () || !Ptr.isUnknownSizeArray ()) {
25412541 S.Stk .push <Pointer>(Ptr.atIndex (0 ));
25422542 return true ;
25432543 }
Original file line number Diff line number Diff line change @@ -436,6 +436,15 @@ namespace Incomplete {
436436 constexpr int C = *F.a; // both-error {{must be initialized by a constant expression}} \
437437 // both-note {{array-to-pointer decay of array member without known bound}}
438438
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+
439448 // / These are from test/SemaCXX/constant-expression-cxx11.cpp
440449 extern int arr[];
441450 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