aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-02-13 10:57:00 -0500
committerJason Merrill <jason@gcc.gnu.org>2018-02-13 10:57:00 -0500
commit9ef86762aaf64ca72844962c0dfaa02370b8e3ff (patch)
tree7a55342fe63681b8e6eaae4ec3111cc3df2cb046
parentff67aff425f2ea1e8c4608783e17eb48556d53e0 (diff)
downloadgcc-9ef86762aaf64ca72844962c0dfaa02370b8e3ff.zip
gcc-9ef86762aaf64ca72844962c0dfaa02370b8e3ff.tar.gz
gcc-9ef86762aaf64ca72844962c0dfaa02370b8e3ff.tar.bz2
PR c++/84080 - ICE with return type deduction and specialization.
* pt.c (determine_specialization): Check uses_template_parms. From-SVN: r257630
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c5
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/auto-fn47.C6
3 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3f37392..7c52ede 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2018-02-13 Jason Merrill <jason@redhat.com>
+ PR c++/84080 - ICE with return type deduction and specialization.
+ * pt.c (determine_specialization): Check uses_template_parms.
+
Fix more variadic capture issues.
* pt.c (find_parameter_packs_r): Also look at explicit captures.
(check_for_bare_parameter_packs): Check current_class_type for
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 02d448e..222084d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2203,6 +2203,11 @@ determine_specialization (tree template_id,
specialize TMPL will produce DECL. */
continue;
+ if (uses_template_parms (targs))
+ /* We deduced something involving 'auto', which isn't a valid
+ template argument. */
+ continue;
+
/* Remove, from the set of candidates, all those functions
whose constraints are not satisfied. */
if (flag_concepts && !constraints_satisfied_p (fn, targs))
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C
new file mode 100644
index 0000000..7de2d9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C
@@ -0,0 +1,6 @@
+// PR c++/84080
+// { dg-do compile { target c++14 } }
+
+template <int i, typename T> T foo();
+
+template <> auto foo<0>() { return 42; } // { dg-error "does not match" }