summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-12 22:40:37 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-12 22:40:37 +0000
commiteaf91eaf8fe31a8ec953f80e27bada7b2aee313b (patch)
tree4baa420d602ecb2cfaaabef3775e96640f5699d8
parent24200b287a68ec59f18dc0344c6239120d849317 (diff)
downloadppe42-gcc-eaf91eaf8fe31a8ec953f80e27bada7b2aee313b.tar.gz
ppe42-gcc-eaf91eaf8fe31a8ec953f80e27bada7b2aee313b.zip
PR c++/38950
* pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144139 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/array20.C10
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7a764b1a22e..7ead4b21c82 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/38950
+ * pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type.
+
2009-02-11 Jason Merrill <jason@redhat.com>
PR c++/39153
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3176dc2b844..db8886c0d6c 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 7b68c6518b4..5a940efcd65 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/38950
+ * g++.dg/template/array20.C: New test.
+
2009-02-12 Uros Bizjak <ubizjak@gmail.com>
* 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 00000000000..2e5c1e33a9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array20.C
@@ -0,0 +1,10 @@
+// PR c++/38950
+
+template <typename T, T N> void f(T(&)[N]);
+
+int main() {
+ int x[2];
+ unsigned int y[2];
+ f(x); // works
+ f(y); // ICE
+}
OpenPOWER on IntegriCloud