Fixed #4074 (Internal error. Token::Match called with varid 0)
This commit is contained in:
parent
990340ba98
commit
0ff8105c71
|
@ -200,7 +200,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
|
|||
return 0;
|
||||
|
||||
// num/type ..
|
||||
if (!tok->isNumber() && !tok->isName())
|
||||
if (!tok->isNumber() && tok->type() != Token::eChar && !tok->isName())
|
||||
return 0;
|
||||
tok = tok->next();
|
||||
if (!tok)
|
||||
|
|
|
@ -126,6 +126,7 @@ private:
|
|||
TEST_CASE(template32); // #3818 - mismatching template not handled well
|
||||
TEST_CASE(template33); // #3818 - inner templates in template instantiation not handled well
|
||||
TEST_CASE(template34); // #3706 - namespace => hang
|
||||
TEST_CASE(template35); // #4074 - A<'x'> a;
|
||||
TEST_CASE(template_unhandled);
|
||||
TEST_CASE(template_default_parameter);
|
||||
TEST_CASE(template_default_type);
|
||||
|
@ -2217,6 +2218,12 @@ private:
|
|||
"template < > int X < int > :: Y ( 0 ) ;", tok(code));
|
||||
}
|
||||
|
||||
void template35() { // #4074 - "A<'x'> a;" is not recognized as template instantiation
|
||||
const char code[] = "template <char c> class A {};\n"
|
||||
"A<'x'> a;";
|
||||
ASSERT_EQUALS("A<'x'> a ; class A<'x'> { }", tok(code));
|
||||
}
|
||||
|
||||
void template_unhandled() {
|
||||
// An unhandled template usage should be simplified..
|
||||
ASSERT_EQUALS("x<int> ( ) ;", tok("x<int>();"));
|
||||
|
|
Loading…
Reference in New Issue