File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4050,7 +4050,7 @@ void Tokenizer::setVarIdPass1()
40504050 const Token *end = tok->findClosingBracket ();
40514051 while (tok != end) {
40524052 if (tok->isName () && !(Token::simpleMatch (tok->next (), " <" ) &&
4053- Token::Match (tok->tokAt (-2 ), " std :: %name%" ))) {
4053+ Token::Match (tok->tokAt (-1 ), " :: %name%" ))) {
40544054 const std::map<std::string, int >::const_iterator it = variableMap.find (tok->str ());
40554055 if (it != variableMap.end ())
40564056 tok->varId (it->second );
Original file line number Diff line number Diff line change @@ -2339,13 +2339,21 @@ class TestVarID : public TestFixture {
23392339 tokenize (" VertexArrayIterator<float[2]> attrPos = m_AttributePos.GetIterator<float[2]>();" ));
23402340 }
23412341
2342- void varid_templateParameter () { // #7046 set varid for "X": std::array<int,X> Y;
2343- const char code[] = " const int X = 0;\n "
2344- " std::array<int,X> Y;\n " ;
2342+ void varid_templateParameter () {
2343+ {
2344+ const char code[] = " const int X = 0;\n " // #7046 set varid for "X": std::array<int,X> Y;
2345+ " std::array<int,X> Y;\n " ;
23452346
2346- ASSERT_EQUALS (" 1: const int X@1 = 0 ;\n "
2347- " 2: std :: array < int , X@1 > Y@2 ;\n " ,
2348- tokenize (code));
2347+ ASSERT_EQUALS (" 1: const int X@1 = 0 ;\n "
2348+ " 2: std :: array < int , X@1 > Y@2 ;\n " ,
2349+ tokenize (code));
2350+ }
2351+ {
2352+ const char code[] = " std::optional<N::Foo<A>> Foo;\n " ; // #11003
2353+
2354+ ASSERT_EQUALS (" 1: std :: optional < N :: Foo < A > > Foo@1 ;\n " ,
2355+ tokenize (code));
2356+ }
23492357 }
23502358
23512359 void varid_templateUsing () { // #5781 #7273
You can’t perform that action at this time.
0 commit comments