Skip to content

Commit cf3f0fa

Browse files
authored
Fix #14676: Syntax error: qRow<> variable template (#8465)
1 parent e9d9729 commit cf3f0fa

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9004,7 +9004,7 @@ void Tokenizer::findGarbageCode() const
90049004
syntaxError(tok);
90059005
if (Token::Match(tok, "[;([{] %comp%|%oror%|%or%|%|/"))
90069006
syntaxError(tok);
9007-
if (Token::Match(tok, "%cop%|= ]") && !Token::simpleMatch(tok, "*") && !(cpp && Token::Match(tok->previous(), "%type%|[|,|%num% &|=|> ]")))
9007+
if (Token::Match(tok, "%cop%|= ]") && !Token::simpleMatch(tok, "*") && !(cpp && Token::Match(tok->previous(), "<|%type%|[|,|%num% &|=|> ]")))
90089008
syntaxError(tok);
90099009
if (Token::Match(tok, "[+-] [;,)]}]") && !(cpp && Token::simpleMatch(tok->previous(), "operator")))
90109010
syntaxError(tok);

test/testgarbage.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ class TestGarbage : public TestFixture {
320320

321321

322322
void final_class_x() {
323-
324323
const char code[] = "class __declspec(dllexport) x final { };";
325324
SimpleTokenizer tokenizer(settings, *this);
326325
ASSERT(tokenizer.tokenize(code));
@@ -1897,6 +1896,12 @@ class TestGarbage : public TestFixture {
18971896

18981897
// #13892
18991898
ASSERT_NO_THROW(checkCode("void foovm(int x[const *]);"));
1899+
1900+
// #14676
1901+
ASSERT_NO_THROW(checkCode("int main() {\n"
1902+
" auto value = m[1 + qRow<>];\n"
1903+
"}\n"));
1904+
ignore_errout();
19001905
}
19011906
};
19021907

0 commit comments

Comments
 (0)