Fix 9444: Syntax error on valid C++14 code (#3403)

This commit is contained in:
Paul Fultz II 2021-08-15 00:43:02 -05:00 committed by GitHub
parent 6d65f86871
commit 422e411b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -4501,7 +4501,7 @@ void Tokenizer::createLinks2()
while (!type.empty() && type.top()->str() == "<") {
const Token* end = type.top()->findClosingBracket();
if (Token::Match(end, "> %comp%|;|.|=|{"))
if (Token::Match(end, "> %comp%|;|.|=|{|::"))
break;
// Variable declaration
if (Token::Match(end, "> %var% ;") && (type.top()->tokAt(-2) == nullptr || Token::Match(type.top()->tokAt(-2), ";|}|{")))

View File

@ -6604,6 +6604,14 @@ private:
" }\n"
"};\n"));
// #9444
ASSERT_NO_THROW(tokenizeAndStringify("template <int> struct a;\n"
"template <long b> using c = a<b>;\n"
"template <long b> c<b> d;\n"
"template <typename> struct e {\n"
" template <typename... f> void g() const { d<e<f &&...>::h>; }\n"
"};\n"));
// #9858
ASSERT_NO_THROW(tokenizeAndStringify(
"struct a {\n"