@@ -842,7 +842,6 @@ void TemplateSimplifier::expandTemplate(
842842 else
843843 continue ;
844844
845- int indentlevel = 0 ;
846845 std::stack<Token *> brackets; // holds "(", "[" and "{" tokens
847846
848847 // FIXME use full name matching somehow
@@ -912,7 +911,6 @@ void TemplateSimplifier::expandTemplate(
912911 // link() newly tokens manually
913912 else if (tok3->str () == " {" ) {
914913 brackets.push (tokenlist.back ());
915- indentlevel++;
916914 } else if (tok3->str () == " (" ) {
917915 brackets.push (tokenlist.back ());
918916 } else if (tok3->str () == " [" ) {
@@ -925,15 +923,10 @@ void TemplateSimplifier::expandTemplate(
925923 tokenlist.addtoken (tokSemicolon, tokSemicolon->linenr (), tokSemicolon->fileIndex ());
926924 }
927925 brackets.pop ();
928- if (indentlevel <= 1 && brackets.empty ()) {
929- // there is a bug if indentlevel is 0
930- // the "}" token should only be added if indentlevel is 1 but I add it always intentionally
931- // if indentlevel ever becomes 0, cppcheck will write:
932- // ### Error: Invalid number of character {
926+ if (brackets.empty ()) {
933927 inTemplateDefinition = false ;
934928 break ;
935929 }
936- --indentlevel;
937930 } else if (tok3->str () == " )" ) {
938931 assert (brackets.empty () == false && brackets.top ()->str () == " (" );
939932 Token::createMutualLinks (brackets.top (), tokenlist.back ());
0 commit comments