@@ -217,6 +217,7 @@ class TestSimplifyTemplate : public TestFixture {
217217 TEST_CASE (template178);
218218 TEST_CASE (template179);
219219 TEST_CASE (template180);
220+ TEST_CASE (template181);
220221 TEST_CASE (template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
221222 TEST_CASE (template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
222223 TEST_CASE (template_specialization_3);
@@ -3711,7 +3712,7 @@ class TestSimplifyTemplate : public TestFixture {
37113712 " class GenericConfigurationHandler<int,std::allocator,std::list> ; "
37123713 " class TargetConfigurationHandler : public GenericConfigurationHandler<int,std::allocator,std::list> { } ; "
37133714 " class GenericConfigurationHandler<int,std::allocator,std::list> { "
3714- " std :: list < int , std :: std :: allocator < int > > m_target_configurations ; "
3715+ " std :: list < int , std :: allocator < int > > m_target_configurations ; "
37153716 " } ;" ;
37163717 ASSERT_EQUALS (exp, tok (code));
37173718 }
@@ -4593,6 +4594,44 @@ class TestSimplifyTemplate : public TestFixture {
45934594 ASSERT_EQUALS (exp, tok (code));
45944595 }
45954596
4597+ void template181 () {
4598+ const char code[] = " struct K { bool b; };\n " // #13747
4599+ " template<bool b>\n "
4600+ " void f(struct K* k) {\n "
4601+ " assert(b == k->b);\n "
4602+ " }\n "
4603+ " void g(struct K* k) {\n "
4604+ " f<false>(k);\n "
4605+ " }\n " ;
4606+ const char exp[] = " struct K { bool b ; } ; "
4607+ " void f<false> ( struct K * k ) ; "
4608+ " void g ( struct K * k ) { "
4609+ " f<false> ( k ) ; "
4610+ " } "
4611+ " void f<false> ( struct K * k ) { "
4612+ " assert ( false == k . b ) ; "
4613+ " }" ;
4614+ ASSERT_EQUALS (exp, tok (code));
4615+
4616+ const char code2[] = " namespace N { bool b = false; }\n " // #13759
4617+ " template<bool b>\n "
4618+ " void f() {\n "
4619+ " assert(b == N::b);\n "
4620+ " }\n "
4621+ " void g() {\n "
4622+ " f<false>();\n "
4623+ " }\n " ;
4624+ const char exp2[] = " namespace N { bool b ; b = false ; } "
4625+ " void f<false> ( ) ; "
4626+ " void g ( ) { "
4627+ " f<false> ( ) ; "
4628+ " } "
4629+ " void f<false> ( ) { "
4630+ " assert ( false == N :: b ) ; "
4631+ " }" ;
4632+ ASSERT_EQUALS (exp2, tok (code2));
4633+ }
4634+
45964635 void template_specialization_1 () { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
45974636 const char code[] = " template <typename T> struct C {};\n "
45984637 " template <typename T> struct S {a};\n "
0 commit comments