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()
7721
7721
continue ;
7722
7722
7723
7723
if (Token::Match (tok, " %type% *|&| %name% (|{" )) {
7724
+ bool isNamespace = Token::simpleMatch (tok, " namespace" );
7724
7725
while (tok && !Token::Match (tok, " (|{" ))
7725
7726
tok = tok->next ();
7727
+ if (isNamespace)
7728
+ continue ;
7726
7729
if (tok)
7727
7730
tok->isInitBracket (true );
7728
7731
/* tok = initVar(tok);
Original file line number Diff line number Diff line change @@ -4518,6 +4518,14 @@ class TestTokenizer : public TestFixture {
4518
4518
ASSERT_EQUALS (" { return doSomething ( X ) , 0 ; }" , tokenizeAndStringify (code));
4519
4519
ASSERT_EQUALS (" " , errout_str ());
4520
4520
}
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
+ }
4521
4529
}
4522
4530
4523
4531
void simplifyInitVar2 () {
You can’t perform that action at this time.
0 commit comments