diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3df6d1102fc..9753bedb40c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2012-01-27 Jakub Jelinek + + PR c++/51852 + * pt.c (tsubst_pack_expansion): Delete and restore + local_specialization whenever need_local_specialization, not just + when saved_local_specializations is non-NULL. + 2012-01-26 Paolo Carlini PR c++/51370 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e440be706cf..ad2b4dfc736 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9582,7 +9582,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, } } - if (saved_local_specializations) + if (need_local_specializations) { htab_delete (local_specializations); local_specializations = saved_local_specializations; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d7f276a9b3f..31ea283ee4b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-01-27 Jakub Jelinek + + PR c++/51852 + * g++.dg/other/gc5.C: New test. + 2012-01-27 Richard Guenther PR tree-optimization/50444 diff --git a/gcc/testsuite/g++.dg/other/gc5.C b/gcc/testsuite/g++.dg/other/gc5.C new file mode 100644 index 00000000000..a369084e00c --- /dev/null +++ b/gcc/testsuite/g++.dg/other/gc5.C @@ -0,0 +1,27 @@ +// PR c++/51852 +// { dg-do compile } +// { dg-options "-std=gnu++11 --param ggc-min-heapsize=0 --param ggc-min-expand=0" } + +template +class transformed {}; + +template +transformed transform (R r, F f); + +template +class joined {}; + +template +joined join (T t, U u); + +template +auto join (T t, U u, V v, Rest... rest) -> decltype (join (join (t, u), v, rest...)); + +template +auto polymorphic_transform (F f, Rs... rs) -> decltype (join (transform(rs, f)...)); + +int +main () +{ + polymorphic_transform (0, 0, 0); +}