File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -7721,8 +7721,11 @@ void Tokenizer::simplifyInitVar()
77217721 continue ;
77227722
77237723 if (Token::Match (tok, " %type% *|&| %name% (|{" )) {
7724+ bool isNamespace = Token::simpleMatch (tok, " namespace" );
77247725 while (tok && !Token::Match (tok, " (|{" ))
77257726 tok = tok->next ();
7727+ if (isNamespace)
7728+ continue ;
77267729 if (tok)
77277730 tok->isInitBracket (true );
77287731 /* tok = initVar(tok);
Original file line number Diff line number Diff line change @@ -4518,6 +4518,14 @@ class TestTokenizer : public TestFixture {
45184518 ASSERT_EQUALS (" { return doSomething ( X ) , 0 ; }" , tokenizeAndStringify (code));
45194519 ASSERT_EQUALS (" " , errout_str ());
45204520 }
4521+
4522+ {
4523+ // 13893
4524+ const char code[] = " namespace test { bool foo; }" ;
4525+ SimpleTokenizer tokenizer (settings0, *this );
4526+ ASSERT (tokenizer.tokenize (code));
4527+ ASSERT (!tokenizer.tokens ()->tokAt (2 )->isInitBracket ());
4528+ }
45214529 }
45224530
45234531 void simplifyInitVar2 () {
You can’t perform that action at this time.
0 commit comments