diff --git a/math/vecops/inc/ROOT/RVec.hxx b/math/vecops/inc/ROOT/RVec.hxx index 30524acf8e008..c6750a8d36490 100644 --- a/math/vecops/inc/ROOT/RVec.hxx +++ b/math/vecops/inc/ROOT/RVec.hxx @@ -213,7 +213,9 @@ class R__CLING_PTRCHECK(off) SmallVectorTemplateCommon : public SmallVectorBase /// SmallVectorStorage is properly-aligned even for small-size of 0. void *getFirstEl() const { - return const_cast(reinterpret_cast(reinterpret_cast(this) + + // get the SmallVectorBase subobject inside RVec + auto *base = static_cast(this); + return const_cast(reinterpret_cast(reinterpret_cast(base) + offsetof(SmallVectorAlignmentAndSize, FirstEl))); } // Space after 'FirstEl' is clobbered, do not add any instance vars after it.