================ @@ -3806,6 +3840,21 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj, return handler.found(Index ? O->getComplexFloatImag() : O->getComplexFloatReal(), ObjType); } + } else if (ObjType->isVectorType()) { + uint64_t Index = Sub.Entries[I].getAsArrayIndex(); + if (Index >= ObjType->castAs<VectorType>()->getNumElements()) { + if (Info.getLangOpts().CPlusPlus11) + Info.FFDiag(E, diag::note_constexpr_access_past_end) + << handler.AccessKind; + else + Info.FFDiag(E); + return handler.failed(); + } + + ObjType = ObjType->castAs<VectorType>()->getElementType(); + + assert(I == N - 1 && "extracting subobject of scalar?"); + return handler.found(O->getVectorElt(Index), ObjType); ---------------- AaronBallman wrote:
```suggestion } else if (const auto *VT = ObjType->getAs<VectorType>()) { uint64_t Index = Sub.Entries[I].getAsArrayIndex(); if (Index >= VT->getNumElements()) { if (Info.getLangOpts().CPlusPlus11) Info.FFDiag(E, diag::note_constexpr_access_past_end) << handler.AccessKind; else Info.FFDiag(E); return handler.failed(); } ObjType = VT->getElementType(); assert(I == N - 1 && "extracting subobject of scalar?"); return handler.found(O->getVectorElt(Index), ObjType); ``` https://github.com/llvm/llvm-project/pull/72607 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits