Skip to content
Merged
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
3 changes: 3 additions & 0 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ void TokenList::addtoken(const Token * tok, const nonneg int lineno, const nonne
mTokensFrontBack->back->column(column);
mTokensFrontBack->back->fileIndex(fileno);
mTokensFrontBack->back->flags(tok->flags());
mTokensFrontBack->back->tokType(tok->tokType());
}

void TokenList::addtoken(const Token *tok, const Token *locationTok)
Expand All @@ -219,6 +220,7 @@ void TokenList::addtoken(const Token *tok, const Token *locationTok)
mTokensFrontBack->back->linenr(locationTok->linenr());
mTokensFrontBack->back->column(locationTok->column());
mTokensFrontBack->back->fileIndex(locationTok->fileIndex());
mTokensFrontBack->back->tokType(tok->tokType());
}

void TokenList::addtoken(const Token *tok)
Expand All @@ -242,6 +244,7 @@ void TokenList::addtoken(const Token *tok)
mTokensFrontBack->back->linenr(tok->linenr());
mTokensFrontBack->back->column(tok->column());
mTokensFrontBack->back->fileIndex(tok->fileIndex());
mTokensFrontBack->back->tokType(tok->tokType());
}


Expand Down
20 changes: 20 additions & 0 deletions test/testsimplifytemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class TestSimplifyTemplate : public TestFixture {
TEST_CASE(template180);
TEST_CASE(template181);
TEST_CASE(template182); // #13770
TEST_CASE(template183);
TEST_CASE(template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
TEST_CASE(template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
TEST_CASE(template_specialization_3);
Expand Down Expand Up @@ -4678,6 +4679,25 @@ class TestSimplifyTemplate : public TestFixture {
ASSERT_EQUALS(exp, tok(code));
}

void template183() { // #11498
const char code[] = "template <typename T>\n"
"struct S {\n"
" void f();\n"
" using X = decltype(&S<T>::f);\n"
"private:\n"
" X x;\n"
"};\n"
"S<int> s;\n";
const char exp[] = "struct S<int> ; "
"S<int> s ; "
"struct S<int> { "
"void f ( ) ; "
"private: "
"decltype ( & S<int> :: f ) x ; "
"} ;";
ASSERT_EQUALS(exp, tok(code));
}

void template_specialization_1() { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
const char code[] = "template <typename T> struct C {};\n"
"template <typename T> struct S {a};\n"
Expand Down