From: Jason Merrill Date: Thu, 12 Feb 2009 22:40:37 +0000 (-0500) Subject: re PR c++/38950 (ICE: deducing function template arguments for array type.) X-Git-Tag: releases/gcc-4.4.0~561 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed7284dd13b289163440589eda15cccd9ca3ea71;p=thirdparty%2Fgcc.git re PR c++/38950 (ICE: deducing function template arguments for array type.) PR c++/38950 * pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type. From-SVN: r144139 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7a764b1a22e4..7ead4b21c828 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2009-02-12 Jason Merrill + + PR c++/38950 + * pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type. + 2009-02-11 Jason Merrill PR c++/39153 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3176dc2b8443..db8886c0d6cc 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13457,7 +13457,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) /* Convert the ARG to the type of PARM; the deduced non-type template argument must exactly match the types of the corresponding parameter. */ - arg = fold (build_nop (TREE_TYPE (parm), arg)); + arg = fold (build_nop (tparm, arg)); else if (uses_template_parms (tparm)) /* We haven't deduced the type of this parameter yet. Try again later. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7b68c6518b43..5a940efcd656 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-02-12 Jason Merrill + + PR c++/38950 + * g++.dg/template/array20.C: New test. + 2009-02-12 Uros Bizjak * gcc.dg/torture/fp-int-convert-float128-timode.c: Do not check diff --git a/gcc/testsuite/g++.dg/template/array20.C b/gcc/testsuite/g++.dg/template/array20.C new file mode 100644 index 000000000000..2e5c1e33a9f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/array20.C @@ -0,0 +1,10 @@ +// PR c++/38950 + +template void f(T(&)[N]); + +int main() { + int x[2]; + unsigned int y[2]; + f(x); // works + f(y); // ICE +}