Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/templatesimplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
return 0;

// num/type ..
if (!tok->isNumber() && tok->tokType() != Token::eChar && tok->tokType() != Token::eString && !tok->isName() && !tok->isOp())
if (!tok->isNumber() && tok->tokType() != Token::eChar && tok->tokType() != Token::eString && !tok->isName() && !tok->isOp() && tok->str() != ".")
return 0;
tok = tok->next();
if (!tok)
Expand Down
14 changes: 14 additions & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class TestTokenizer : public TestFixture {
TEST_CASE(vardecl_stl_3);
TEST_CASE(vardecl_template_1);
TEST_CASE(vardecl_template_2);
TEST_CASE(vardecl_template_3);
TEST_CASE(vardecl_union);
TEST_CASE(vardecl_par); // #2743 - set links if variable type contains parentheses
TEST_CASE(vardecl_par2); // #3912 - set correct links
Expand Down Expand Up @@ -2387,6 +2388,19 @@ class TestTokenizer : public TestFixture {
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
}

void vardecl_template_3() {
const char code[] = "template <class T>\n" // #14909
"void f(T x) {\n"
" const auto y = h<T, x.size()>;\n"
"}";
const char expected[] = "template < class T >\n"
"void f ( T x ) {\n"
"const auto y = h < T , x . size ( ) > ;\n"
"}";
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
ASSERT_EQUALS("[test.cpp:3:11]: (debug) auto token with no type. [autoNoType]\n", errout_str());
}

void vardecl_union() {
// ticket #1976
const char code1[] = "class Fred { public: union { int a ; int b ; } ; } ;";
Expand Down
Loading