From: Dodji Seketeli Date: Sun, 17 Jan 2010 10:24:16 +0000 (+0000) Subject: re PR c++/42697 (ice-on-legal-code: template class template function local objects) X-Git-Tag: releases/gcc-4.5.0~1182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4548cb4b83437e17e7392971ffcde82dacc59854;p=thirdparty%2Fgcc.git re PR c++/42697 (ice-on-legal-code: template class template function local objects) Fix PR c++/42697 gcc/cp/ChangeLog: PR c++/42697 *pt.c (tsubst_decl): Get the arguments of a specialization from the specialization template, not from the most general template. gcc/testsuite/ChangeLog: PR c++/42697 * g++.dg/template/crash94.C: New test. From-SVN: r155975 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 08307272a00b..dc563cc2524a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-01-17 Dodji Seketeli + + PR c++/42697 + *pt.c (tsubst_decl): Get the arguments of a specialization from + the specialization template, not from the most general template. + 2010-01-16 Jason Merrill PR c++/42761 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f27b931edd82..0acb86064198 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8825,7 +8825,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) specialize R. */ gen_tmpl = most_general_template (DECL_TI_TEMPLATE (t)); argvec = tsubst_template_args (DECL_TI_ARGS - (DECL_TEMPLATE_RESULT (gen_tmpl)), + (DECL_TEMPLATE_RESULT + (DECL_TI_TEMPLATE (t))), args, complain, in_decl); /* Check to see if we already have this specialization. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1302d42db3ae..8211355516b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-01-17 Dodji Seketeli + + PR c++/42697 + * g++.dg/template/crash94.C: New test. + 2010-01-17 Jie Zhang PR debug/42767 diff --git a/gcc/testsuite/g++.dg/template/crash94.C b/gcc/testsuite/g++.dg/template/crash94.C new file mode 100644 index 000000000000..810aed0a61c6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash94.C @@ -0,0 +1,28 @@ +// Origin: PR c++/42697 +// { dg-do compile } + +template +class fparser +{ + template + void eval2(Value_t r[2]); +public: + void evaltest(); +}; + +template<> +template +void fparser::eval2(int r[2]) +{ + struct ObjType {}; +} + + +template +void fparser::evaltest + () +{ + eval2(0); +} + +template class fparser;