Skip to content

Commit 422e411

Browse files
authored
Fix 9444: Syntax error on valid C++14 code (danmar#3403)
1 parent 6d65f86 commit 422e411

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4501,7 +4501,7 @@ void Tokenizer::createLinks2()
45014501

45024502
while (!type.empty() && type.top()->str() == "<") {
45034503
const Token* end = type.top()->findClosingBracket();
4504-
if (Token::Match(end, "> %comp%|;|.|=|{"))
4504+
if (Token::Match(end, "> %comp%|;|.|=|{|::"))
45054505
break;
45064506
// Variable declaration
45074507
if (Token::Match(end, "> %var% ;") && (type.top()->tokAt(-2) == nullptr || Token::Match(type.top()->tokAt(-2), ";|}|{")))

test/testtokenize.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6604,6 +6604,14 @@ class TestTokenizer : public TestFixture {
66046604
" }\n"
66056605
"};\n"));
66066606

6607+
// #9444
6608+
ASSERT_NO_THROW(tokenizeAndStringify("template <int> struct a;\n"
6609+
"template <long b> using c = a<b>;\n"
6610+
"template <long b> c<b> d;\n"
6611+
"template <typename> struct e {\n"
6612+
" template <typename... f> void g() const { d<e<f &&...>::h>; }\n"
6613+
"};\n"));
6614+
66076615
// #9858
66086616
ASSERT_NO_THROW(tokenizeAndStringify(
66096617
"struct a {\n"

0 commit comments

Comments
 (0)