diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index b1122e9d5..c6d2cc50a 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2189,10 +2189,9 @@ Variable& Variable::operator=(const Variable &var) mScope = var.mScope; mDimensions = var.mDimensions; delete mValueType; + mValueType = nullptr; if (var.mValueType) mValueType = new ValueType(*var.mValueType); - else - mValueType = nullptr; return *this; } @@ -2347,6 +2346,7 @@ void Variable::setValueType(const ValueType &valueType) return; } delete mValueType; + mValueType = nullptr; mValueType = new ValueType(valueType); if ((mValueType->pointer > 0) && (!isArray() || Token::Match(mNameToken->previous(), "( * %name% )"))) setFlag(fIsPointer, true); diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index d9aba94eb..a7dd7d9c7 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -546,7 +546,7 @@ public: * @return length of dimension */ MathLib::bigint dimension(nonneg int index_) const { - return mDimensions[index_].num; + return mDimensions.at(index_).num; } /** @@ -554,7 +554,7 @@ public: * @return length of dimension known */ bool dimensionKnown(nonneg int index_) const { - return mDimensions[index_].known; + return mDimensions.at(index_).known; } /** diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 89eef034d..b4c822def 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -234,14 +234,6 @@ TemplateSimplifier::TokenAndName::TokenAndName(const TokenAndName& other) : mToken->templateSimplifierPointer(this); } -TemplateSimplifier::TokenAndName::TokenAndName(TokenAndName&& other) NOEXCEPT : - mToken(other.mToken), mScope(std::move(other.mScope)), mName(std::move(other.mName)), mFullName(std::move(other.mFullName)), - mNameToken(other.mNameToken), mParamEnd(other.mParamEnd), mFlags(other.mFlags) -{ - if (mToken) - mToken->templateSimplifierPointer(this); -} - TemplateSimplifier::TokenAndName::~TokenAndName() { if (mToken && mToken->templateSimplifierPointers()) diff --git a/lib/templatesimplifier.h b/lib/templatesimplifier.h index 997c506e0..e8e77507e 100644 --- a/lib/templatesimplifier.h +++ b/lib/templatesimplifier.h @@ -152,7 +152,6 @@ public: */ TokenAndName(Token *token, std::string scope, const Token *nameToken, const Token *paramEnd); TokenAndName(const TokenAndName& other); - TokenAndName(TokenAndName&& other) NOEXCEPT; ~TokenAndName(); bool operator == (const TokenAndName & rhs) const {