Fixed #2011 (Parser error in template function)
This commit is contained in:
parent
66111a294d
commit
fbffaade2e
|
@ -992,11 +992,14 @@ void Tokenizer::simplifyTypedef()
|
|||
tok = specEnd->next();
|
||||
}
|
||||
}
|
||||
else if (Token::Match(tok->tokAt(offset), "( ::| %var% :: *|&| const|volatile| const|volatile| %type% ) ("))
|
||||
else if (Token::Match(tok->tokAt(offset), "( ::| %var% :: *|&| const|volatile| const|volatile| %type% ) (") ||
|
||||
Token::Match(tok->tokAt(offset), "( ::| %var% < %type% > :: *|&| const|volatile| const|volatile| %type% ) ("))
|
||||
{
|
||||
namespaceStart = tok->tokAt(offset + 1);
|
||||
if (tok->tokAt(offset + 1)->str() == "::")
|
||||
offset++;
|
||||
if (tok->tokAt(offset + 2)->str() == "<")
|
||||
offset += 3;
|
||||
namespaceEnd = tok->tokAt(offset + 2);
|
||||
functionPtr = tok->tokAt(offset + 3)->str() == "*";
|
||||
functionRef = tok->tokAt(offset + 3)->str() == "&";
|
||||
|
|
|
@ -213,6 +213,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef56); // ticket #1829
|
||||
TEST_CASE(simplifyTypedef57); // ticket #1846
|
||||
TEST_CASE(simplifyTypedef58); // ticket #1963
|
||||
TEST_CASE(simplifyTypedef59); // ticket #2011
|
||||
|
||||
TEST_CASE(simplifyTypedefFunction1);
|
||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||
|
@ -4374,6 +4375,20 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void simplifyTypedef59() // ticket #2011
|
||||
{
|
||||
const char code[] = "template<typename DISPATCHER> class SomeTemplateClass {\n"
|
||||
" typedef void (SomeTemplateClass<DISPATCHER>::*MessageDispatcherFunc)(SerialInputMessage&);\n"
|
||||
"};\n";
|
||||
// The expected result..
|
||||
const std::string expected("; ;");
|
||||
ASSERT_EQUALS(expected, sizeof_(code));
|
||||
|
||||
// Check for output..
|
||||
checkSimplifyTypedef(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue