diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index a0c91242f..7b4b1e3e4 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -569,9 +569,10 @@ void TemplateSimplifier::useDefaultArgumentValues(const std::list &temp if (tok->str() == ">") { if (Token::Match(tok, "> class|struct %name%")) classname = tok->strAt(2); - --templateParmDepth; - if (0 == templateParmDepth) + if (templateParmDepth<2) break; + else + --templateParmDepth; } // next template parameter @@ -601,7 +602,7 @@ void TemplateSimplifier::useDefaultArgumentValues(const std::list &temp // count the parameters.. tok = tok->next(); - unsigned int usedpar = TemplateSimplifier::templateParameters(tok); + const unsigned int usedpar = TemplateSimplifier::templateParameters(tok); tok = tok->findClosingBracket(); if (tok && tok->str() == ">") { diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 913209890..38c4ca573 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9860,9 +9860,10 @@ void Tokenizer::simplifyQtSignalsSlots() else tok2 = tok2->link(); } else if (tok2->str() == "}") { - --indentlevel; - if (indentlevel == 0) + if (indentlevel<2) break; + else + --indentlevel; } if (tok2->strAt(1) == "Q_OBJECT") {