symengine
symengine copied to clipboard
ClangTidy `clang-analyzer-core.uninitialized.Assign` error in `RCP`
When running symengine
in aarch64-darwin, ClangTidy 18, and with defines WITH_SYMENGINE_RCP
and WITH_SYMENGINE_THREADSAFE
, I'm getting an error from the move constructor:
external/symengine/symengine/symengine_rcp.h:129:48: error: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign,-warnings-as-errors]
129 | RCP(RCP<T> &&rp) SYMENGINE_NOEXCEPT : ptr_(rp.ptr_)
trimmed backtrace:
./rigid_geometric_algebra/blade.hpp:35:12: note: Calling move constructor for 'Expression'
35 | return std::forward<Self>(self).coefficient;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/symengine/symengine/expression.h:75:11: note: Calling move constructor for 'RCP<const SymEngine::Basic>'
75 | : m_basic(std::move(other.m_basic))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/symengine/symengine/symengine_rcp.h:129:48: note: Assigned value is garbage or undefined
129 | RCP(RCP<T> &&rp) SYMENGINE_NOEXCEPT : ptr_(rp.ptr_)
| ^~~~~~~
This error is still triggered if the higher level value (self
) is cast to const (so this check still triggers in the copy constructor).
Some searches online seem to suggest there may be false positives with this check. Deleting the move constructor, such that the converting move constructor is called instead, does not trigger this check. I did not run into any issues when running this test with ASAN.
Functionally, I assume RCP
is an implementation of shared_ptr
although the location of the control block seems different.