summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-14 17:23:06 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-14 17:23:06 +0000
commit867a6ba93b2c7f34c60bfef83450e719651aa42e (patch)
tree76d9cd96802997f41b70110000f15c62eeed52b1
parent8eb56753ca3a81e9a65c7d08242a19a7823ff669 (diff)
downloadgcc-867a6ba93b2c7f34c60bfef83450e719651aa42e.tar.gz
PR c++/78701
* pt.c (type_unification_real): Check tsubst arg doesn't have remaining template parms before converting it. PR c++/78701 * g++.dg/cpp0x/pr78701.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@243660 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr78701.C9
4 files changed, 28 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index db003a45f73..d23864e771e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-14 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/78701
+ * pt.c (type_unification_real): Check tsubst arg doesn't have
+ remaining template parms before converting it.
+
2016-12-08 Nathan Sidwell <nathan@acm.org>
PR c++/78551
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f550a450d3d..744b4617b2d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18563,14 +18563,19 @@ type_unification_real (tree tparms,
if (DECL_P (parm))
input_location = DECL_SOURCE_LOCATION (parm);
arg = tsubst_template_arg (arg, targs, complain, NULL_TREE);
- arg = convert_template_argument (parm, arg, targs, complain,
- i, NULL_TREE);
+ if (!uses_template_parms (arg))
+ arg = convert_template_argument (parm, arg, targs, complain,
+ i, NULL_TREE);
+ else if (saw_undeduced < 2)
+ arg = NULL_TREE;
+ else
+ arg = error_mark_node;
input_location = save_loc;
*checks = get_deferred_access_checks ();
pop_deferring_access_checks ();
if (arg == error_mark_node)
return 1;
- else
+ else if (arg)
{
TREE_VEC_ELT (targs, i) = arg;
/* The position of the first default template argument,
@@ -18578,7 +18583,6 @@ type_unification_real (tree tparms,
Record that. */
if (!NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs))
SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs, i);
- continue;
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 22631aa6e7f..02ebbe7842d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-12-14 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/78701
+ * g++.dg/cpp0x/pr78701.C: New.
+
2016-12-14 Jakub Jelinek <jakub@redhat.com>
PR target/78796
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78701.C b/gcc/testsuite/g++.dg/cpp0x/pr78701.C
new file mode 100644
index 00000000000..6fef926876b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr78701.C
@@ -0,0 +1,9 @@
+// PR c++/58707
+// { dg-do compile { target c++11 } }
+
+// ICE during deduction of default parms
+
+template <class T, T N = T(), bool B = N>
+ void f(T x) {}
+
+template void f<int> (int);