Skip to content

Commit fa99249

Browse files
committed
[vecops] Delay RVec initialization to avoid uninitialized variable warning
1 parent c75d1e9 commit fa99249

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

math/vecops/inc/ROOT/RVec.hxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ class R__CLING_PTRCHECK(off) SmallVectorTemplateCommon : public SmallVectorBase
219219
// Space after 'FirstEl' is clobbered, do not add any instance vars after it.
220220

221221
protected:
222-
SmallVectorTemplateCommon(size_t Size) : Base(getFirstEl(), Size) {}
222+
SmallVectorTemplateCommon(size_t Size) : Base(nullptr, Size) {
223+
// We delay the initialization of fBeginX until the constructor of the derived class, to avoid doing pointer math
224+
// on an object that is not yet fully constructed.
225+
fBeginX = getFirstEl();
226+
}
223227

224228
void grow_pod(size_t MinSize, size_t TSize) { Base::grow_pod(getFirstEl(), MinSize, TSize); }
225229

0 commit comments

Comments
 (0)