rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land.
Committed as r301822. ================ Comment at: lib/AST/ExprConstant.cpp:1301 void addUnsizedArray(EvalInfo &Info, QualType ElemTy) { - assert(Designator.Entries.empty() && getType(Base)->isPointerType()); - assert(isBaseAnAllocSizeCall(Base) && - "Only alloc_size bases can have unsized arrays"); - Designator.FirstEntryIsAnUnsizedArray = true; Designator.addUnsizedArrayUnchecked(ElemTy); } ---------------- rsmith wrote: > We should call `checkSubobject` here, for cases like: > > ``` > void f(int n) { > int arr[2][n]; > constexpr int *p = &arr[2][0]; > } > ``` > > ... which we should reject because `arr[2]` is a one-past-the-end lvalue, so > cannot be indexed (we reject this if `n` is instead a constant). Turns out this case is already failing before we get here: forming `arr[2]` requires determining the size of the array element type `int[n]`, which fails. https://reviews.llvm.org/D32372 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits