aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-02-17 13:42:43 -0500
committerJason Merrill <jason@gcc.gnu.org>2017-02-17 13:42:43 -0500
commitedf1849aa6b55871d799a0e8a574eb752f0b4c8a (patch)
tree97498c6d2a37503e994004d5f586097bf392108d /gcc
parentb10c7cd74ac9c17f0aa1cb5dbdb0e1227b421a90 (diff)
downloadgcc-edf1849aa6b55871d799a0e8a574eb752f0b4c8a.zip
gcc-edf1849aa6b55871d799a0e8a574eb752f0b4c8a.tar.gz
gcc-edf1849aa6b55871d799a0e8a574eb752f0b4c8a.tar.bz2
PR c++/79549 - C++17 ICE with non-type auto template parameter pack
* pt.c (convert_template_argument): Just return an auto arg pack. (tsubst_template_args): Don't tsubst an auto pack type. From-SVN: r245544
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c11
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/nontype-auto8.C10
3 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 65f2d19..a660c43 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2017-02-17 Jason Merrill <jason@redhat.com>
+ PR c++/79549 - C++17 ICE with non-type auto template parameter pack
+ * pt.c (convert_template_argument): Just return an auto arg pack.
+ (tsubst_template_args): Don't tsubst an auto pack type.
+
PR c++/79556 - C++17 ICE with non-type auto
* pt.c (do_auto_deduction): Don't try to deduce from null type.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 093c0f9..04479d4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7612,6 +7612,10 @@ convert_template_argument (tree parm,
if (tree a = type_uses_auto (t))
{
+ if (ARGUMENT_PACK_P (orig_arg))
+ /* There's nothing to check for an auto argument pack. */
+ return orig_arg;
+
t = do_auto_deduction (t, arg, a, complain, adc_unify, args);
if (t == error_mark_node)
return error_mark_node;
@@ -11649,8 +11653,11 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl)
new_arg = error_mark_node;
if (TREE_CODE (new_arg) == NONTYPE_ARGUMENT_PACK) {
- TREE_TYPE (new_arg) = tsubst (TREE_TYPE (orig_arg), args,
- complain, in_decl);
+ if (type_uses_auto (TREE_TYPE (orig_arg)))
+ TREE_TYPE (new_arg) = TREE_TYPE (orig_arg);
+ else
+ TREE_TYPE (new_arg) = tsubst (TREE_TYPE (orig_arg), args,
+ complain, in_decl);
TREE_CONSTANT (new_arg) = TREE_CONSTANT (orig_arg);
if (TREE_TYPE (new_arg) == error_mark_node)
diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto8.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto8.C
new file mode 100644
index 0000000..da4c88b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto8.C
@@ -0,0 +1,10 @@
+// PR c++/79549
+// { dg-options -std=c++1z }
+
+template <auto...>
+struct meow;
+
+template <auto C>
+struct meow<C> { };
+
+meow<1> m;