Skip to content

Commit 3a7e382

Browse files
Fix #11498 debug: Failed to parse 'x'. The checking continues anyway. (#8345)
1 parent b17b4ed commit 3a7e382

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

lib/tokenlist.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ void TokenList::addtoken(const Token * tok, const nonneg int lineno, const nonne
198198
mTokensFrontBack->back->column(column);
199199
mTokensFrontBack->back->fileIndex(fileno);
200200
mTokensFrontBack->back->flags(tok->flags());
201+
mTokensFrontBack->back->tokType(tok->tokType());
201202
}
202203

203204
void TokenList::addtoken(const Token *tok, const Token *locationTok)
@@ -219,6 +220,7 @@ void TokenList::addtoken(const Token *tok, const Token *locationTok)
219220
mTokensFrontBack->back->linenr(locationTok->linenr());
220221
mTokensFrontBack->back->column(locationTok->column());
221222
mTokensFrontBack->back->fileIndex(locationTok->fileIndex());
223+
mTokensFrontBack->back->tokType(tok->tokType());
222224
}
223225

224226
void TokenList::addtoken(const Token *tok)
@@ -242,6 +244,7 @@ void TokenList::addtoken(const Token *tok)
242244
mTokensFrontBack->back->linenr(tok->linenr());
243245
mTokensFrontBack->back->column(tok->column());
244246
mTokensFrontBack->back->fileIndex(tok->fileIndex());
247+
mTokensFrontBack->back->tokType(tok->tokType());
245248
}
246249

247250

test/testsimplifytemplate.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ class TestSimplifyTemplate : public TestFixture {
224224
TEST_CASE(template180);
225225
TEST_CASE(template181);
226226
TEST_CASE(template182); // #13770
227+
TEST_CASE(template183);
227228
TEST_CASE(template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
228229
TEST_CASE(template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
229230
TEST_CASE(template_specialization_3);
@@ -4678,6 +4679,25 @@ class TestSimplifyTemplate : public TestFixture {
46784679
ASSERT_EQUALS(exp, tok(code));
46794680
}
46804681

4682+
void template183() { // #11498
4683+
const char code[] = "template <typename T>\n"
4684+
"struct S {\n"
4685+
" void f();\n"
4686+
" using X = decltype(&S<T>::f);\n"
4687+
"private:\n"
4688+
" X x;\n"
4689+
"};\n"
4690+
"S<int> s;\n";
4691+
const char exp[] = "struct S<int> ; "
4692+
"S<int> s ; "
4693+
"struct S<int> { "
4694+
"void f ( ) ; "
4695+
"private: "
4696+
"decltype ( & S<int> :: f ) x ; "
4697+
"} ;";
4698+
ASSERT_EQUALS(exp, tok(code));
4699+
}
4700+
46814701
void template_specialization_1() { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
46824702
const char code[] = "template <typename T> struct C {};\n"
46834703
"template <typename T> struct S {a};\n"

0 commit comments

Comments
 (0)