public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH]  PR c++/88312 - pack expansion of decltype.
@ 2019-01-11 22:36 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2019-01-11 22:36 UTC (permalink / raw)
  To: gcc-patches

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.

Tested x86_64-pc-linux-gnu, applying to trunk.

	* pt.c (instantiation_dependent_r): A template non-type parameter
	pack is instantiation-dependent.
---
 gcc/cp/pt.c                                     | 2 ++
 gcc/testsuite/g++.dg/cpp0x/variadic-decltype1.C | 9 +++++++++
 gcc/cp/ChangeLog                                | 6 ++++++
 3 files changed, 17 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-decltype1.C

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 84f59a2c356..f062a2b9707 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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
index 00000000000..c87c6bad59f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-decltype1.C
@@ -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)))...>;
+}
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9208f1e4937..0eb669b3eac 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.

base-commit: 0c2ebbc4659d15c2a546b75323ba6af1ff1d073b
-- 
2.20.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-11 22:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11 22:36 [C++ PATCH] PR c++/88312 - pack expansion of decltype Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).