From fd49112196637be2cffa771efa64c5738b557358 Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Sat, 18 Aug 2018 00:32:30 -0500 Subject: [PATCH] Avoid duplicates in the error path (#1346) --- lib/astutils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index f1695cb68..ab6c8fafd 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -218,7 +218,10 @@ static void followVariableExpressionError(const Token *tok1, const Token *tok2, return; if (!tok2) return; - errors->push_back(std::make_pair(tok2, "'" + tok1->str() + "' is assigned value '" + tok2->expressionString() + "' here.")); + ErrorPathItem item = std::make_pair(tok2, "'" + tok1->str() + "' is assigned value '" + tok2->expressionString() + "' here."); + if(std::find(errors->begin(), errors->end(), item) != errors->end()) + return; + errors->push_back(item); } bool isSameExpression(bool cpp, bool macro, const Token *tok1, const Token *tok2, const Library& library, bool pure, ErrorPath* errors)