@@ -3239,24 +3239,30 @@ void Tokenizer::createLinks2()
32393239 // Then this is probably a template instantiation if either "B" or "C" has comparisons
32403240 if (token->tokType () == Token::eLogicalOp && !type.empty () && type.top ()->str () == " <" ) {
32413241 const Token *prev = token->previous ();
3242- while (Token::Match (prev, " %name%|%num%|%str%|%cop%|)|]" )) {
3242+ bool foundComparison = false ;
3243+ while (Token::Match (prev, " %name%|%num%|%str%|%cop%|)|]" ) && prev != type.top ()) {
32433244 if (prev->str () == " )" || prev->str () == " ]" )
32443245 prev = prev->link ();
3245- else if (prev->tokType () == Token::eLogicalOp || prev-> isComparisonOp () )
3246+ else if (prev->tokType () == Token::eLogicalOp)
32463247 break ;
3248+ else if (prev->isComparisonOp ())
3249+ foundComparison = true ;
32473250 prev = prev->previous ();
32483251 }
3249- if (prev && prev != type.top () && prev-> isComparisonOp () )
3252+ if (prev == type.top () && foundComparison )
32503253 continue ;
32513254 const Token *next = token->next ();
3252- while (Token::Match (next, " %name%|%num%|%str%|%cop%|(|[" )) {
3255+ foundComparison = false ;
3256+ while (Token::Match (next, " %name%|%num%|%str%|%cop%|(|[" ) && next->str () != " >" ) {
32533257 if (next->str () == " (" || next->str () == " [" )
32543258 next = next->link ();
3255- else if (next->tokType () == Token::eLogicalOp || next-> isComparisonOp () )
3259+ else if (next->tokType () == Token::eLogicalOp)
32563260 break ;
3261+ else if (next->isComparisonOp ())
3262+ foundComparison = true ;
32573263 next = next->next ();
32583264 }
3259- if (next && next != type. top () && next-> isComparisonOp () && next-> str () != " >" )
3265+ if (next && next-> str () == " >" && foundComparison )
32603266 continue ;
32613267 }
32623268
0 commit comments