File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5650,6 +5650,8 @@ void Tokenizer::createLinks2()
56505650 const Token* end = type.top ()->findClosingBracket ();
56515651 if (Token::Match (end, " > %comp%|;|.|=|{|}|(|)|::" ))
56525652 break ;
5653+ if (Token::Match (end, " > %name% (|::" ))
5654+ break ;
56535655 // Variable declaration
56545656 if (Token::Match (end, " > %var% ;" ) && (type.top ()->tokAt (-2 ) == nullptr || Token::Match (type.top ()->tokAt (-2 ), " ;|}|{" )))
56555657 break ;
Original file line number Diff line number Diff line change @@ -4004,6 +4004,21 @@ class TestTokenizer : public TestFixture {
40044004 ASSERT_EQUALS (true , tok1->link () == tok2);
40054005 ASSERT_EQUALS (true , tok2->link () == tok1);
40064006 }
4007+
4008+ {
4009+ const char code[] = " std::enable_if_t<0 || 1, void> f() {}\n " // #14982
4010+ " std::enable_if_t<0 || 1, void> S::g() {}\n " ;
4011+ SimpleTokenizer tokenizer (settingsDefault, *this );
4012+ ASSERT (tokenizer.tokenize (code));
4013+ const Token* tok1 = Token::findsimplematch (tokenizer.tokens (), " < 0" );
4014+ const Token* tok2 = Token::findsimplematch (tok1, " > f" );
4015+ ASSERT_EQUALS (true , tok1->link () == tok2);
4016+ ASSERT_EQUALS (true , tok2->link () == tok1);
4017+ const Token* tok3 = Token::findsimplematch (tok2, " < 0" );
4018+ const Token* tok4 = Token::findsimplematch (tok3, " > S" );
4019+ ASSERT_EQUALS (true , tok3->link () == tok4);
4020+ ASSERT_EQUALS (true , tok4->link () == tok3);
4021+ }
40074022 }
40084023
40094024 void simplifyString () {
You can’t perform that action at this time.
0 commit comments