PR c++/88312 - pack expansion of decltype.
authorJason Merrill <jason@redhat.com>
Fri, 11 Jan 2019 22:37:01 +0000 (17:37 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 11 Jan 2019 22:37:01 +0000 (17:37 -0500)
The standard doesn't really talk about an expression depending on the number
of elements of a pack, but that's definitely an important form of template
argument dependence.

* pt.c (instantiation_dependent_r): A template non-type parameter
pack is instantiation-dependent.

From-SVN: r267860

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/variadic-decltype1.C [new file with mode: 0644]

index 9208f1e4937a39cef7b96e7679fe5eb868633afb..0eb669b3eac261657275c36bd6c6a169b213d2ac 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/88312 - pack expansion of decltype.
+       * pt.c (instantiation_dependent_r): A template non-type parameter
+       pack is instantiation-dependent.
+
 2019-01-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/88613 - ICE with use of const var in lambda.
index 84f59a2c3561b056309020641605f43daeeb490d..f062a2b9707dc95667744f17746ef627f0c73fc8 100644 (file)
@@ -25736,6 +25736,8 @@ instantiation_dependent_r (tree *tp, int *walk_subtrees,
     case TEMPLATE_PARM_INDEX:
       if (dependent_type_p (TREE_TYPE (*tp)))
        return *tp;
+      if (TEMPLATE_PARM_PARAMETER_PACK (*tp))
+       return *tp;
       /* We'll check value-dependence separately.  */
       return NULL_TREE;
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-decltype1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-decltype1.C
new file mode 100644 (file)
index 0000000..c87c6ba
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/88555
+// { dg-do compile { target c++11 } }
+
+template <class ...> struct T {};
+
+template <int ...Indices>
+void test() {
+    using Test = T<decltype((Indices, char(0)))...>;
+}