File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
200200 return 0 ;
201201
202202 // num/type ..
203- if (!tok->isNumber () && !tok->isName ())
203+ if (!tok->isNumber () && tok-> type () != Token::eChar && !tok->isName ())
204204 return 0 ;
205205 tok = tok->next ();
206206 if (!tok)
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ class TestSimplifyTokens : public TestFixture {
126126 TEST_CASE (template32); // #3818 - mismatching template not handled well
127127 TEST_CASE (template33); // #3818 - inner templates in template instantiation not handled well
128128 TEST_CASE (template34); // #3706 - namespace => hang
129+ TEST_CASE (template35); // #4074 - A<'x'> a;
129130 TEST_CASE (template_unhandled);
130131 TEST_CASE (template_default_parameter);
131132 TEST_CASE (template_default_type);
@@ -2217,6 +2218,12 @@ class TestSimplifyTokens : public TestFixture {
22172218 " template < > int X < int > :: Y ( 0 ) ;" , tok (code));
22182219 }
22192220
2221+ void template35 () { // #4074 - "A<'x'> a;" is not recognized as template instantiation
2222+ const char code[] = " template <char c> class A {};\n "
2223+ " A<'x'> a;" ;
2224+ ASSERT_EQUALS (" A<'x'> a ; class A<'x'> { }" , tok (code));
2225+ }
2226+
22202227 void template_unhandled () {
22212228 // An unhandled template usage should be simplified..
22222229 ASSERT_EQUALS (" x<int> ( ) ;" , tok (" x<int>();" ));
You can’t perform that action at this time.
0 commit comments