@@ -217,6 +217,7 @@ class TestSimplifyTemplate : public TestFixture {
217
217
TEST_CASE (template178);
218
218
TEST_CASE (template179);
219
219
TEST_CASE (template180);
220
+ TEST_CASE (template181);
220
221
TEST_CASE (template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
221
222
TEST_CASE (template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
222
223
TEST_CASE (template_specialization_3);
@@ -3711,7 +3712,7 @@ class TestSimplifyTemplate : public TestFixture {
3711
3712
" class GenericConfigurationHandler<int,std::allocator,std::list> ; "
3712
3713
" class TargetConfigurationHandler : public GenericConfigurationHandler<int,std::allocator,std::list> { } ; "
3713
3714
" 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 ; "
3715
3716
" } ;" ;
3716
3717
ASSERT_EQUALS (exp, tok (code));
3717
3718
}
@@ -4593,6 +4594,44 @@ class TestSimplifyTemplate : public TestFixture {
4593
4594
ASSERT_EQUALS (exp, tok (code));
4594
4595
}
4595
4596
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
+
4596
4635
void template_specialization_1 () { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
4597
4636
const char code[] = " template <typename T> struct C {};\n "
4598
4637
" template <typename T> struct S {a};\n "
0 commit comments