Skip to content

Commit e5659cc

Browse files
Fix #12659 False positive: syntaxError when there is && in array argument (#6341)
1 parent 4efb001 commit e5659cc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8653,7 +8653,7 @@ void Tokenizer::findGarbageCode() const
86538653
syntaxError(tok);
86548654
if (Token::Match(tok, "%cop%|=|,|[ %or%|%oror%|/|%"))
86558655
syntaxError(tok);
8656-
if (Token::Match(tok, "[;([{] %comp%|&&|%oror%|%or%|%|/"))
8656+
if (Token::Match(tok, "[;([{] %comp%|%oror%|%or%|%|/"))
86578657
syntaxError(tok);
86588658
if (Token::Match(tok, "%cop%|= ]") && !(isCPP() && Token::Match(tok->previous(), "%type%|[|,|%num% &|=|> ]")))
86598659
syntaxError(tok);

test/testtokenize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7134,6 +7134,9 @@ class TestTokenizer : public TestFixture {
71347134
ASSERT_NO_THROW(tokenizeAndStringify("S* g = ::new(ptr) S();")); // #12552
71357135
ASSERT_NO_THROW(tokenizeAndStringify("void f(int* p) { return ::delete p; }"));
71367136

7137+
ASSERT_NO_THROW(tokenizeAndStringify("template <typename T, int N>\n" // #12659
7138+
"constexpr void f(T(&&a)[N]) {}"));
7139+
71377140
ignore_errout();
71387141
}
71397142

0 commit comments

Comments
 (0)