@@ -219,6 +219,7 @@ class TestSimplifyTemplate : public TestFixture {
219219 TEST_CASE (template178);
220220 TEST_CASE (template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
221221 TEST_CASE (template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
222+ TEST_CASE (template_specialization_3);
222223 TEST_CASE (template_enum); // #6299 Syntax error in complex enum declaration (including template)
223224 TEST_CASE (template_unhandled);
224225 TEST_CASE (template_default_parameter);
@@ -4564,6 +4565,24 @@ class TestSimplifyTemplate : public TestFixture {
45644565 ASSERT_EQUALS (exp, tok (code));
45654566 }
45664567
4568+ void template_specialization_3 () {
4569+ const char code[] = " namespace N {\n " // #12312
4570+ " template <typename T>\n "
4571+ " bool equal(const T&);\n "
4572+ " template <>\n "
4573+ " bool equal<int>(const int&) { return false; }\n "
4574+ " }\n "
4575+ " void f(bool equal, int i) { if (equal) {} }\n " ;
4576+ const char exp[] = " namespace N { "
4577+ " bool equal<int> ( const int & ) ; "
4578+ " template < typename T > "
4579+ " bool equal ( const T & ) ; "
4580+ " bool equal<int> ( const int & ) { return false ; } "
4581+ " } "
4582+ " void f ( bool equal , int i ) { if ( equal ) { } }" ;
4583+ ASSERT_EQUALS (exp, tok (code));
4584+ }
4585+
45674586 void template_enum () {
45684587 const char code1[] = " template <class T>\n "
45694588 " struct Unconst {\n "
0 commit comments