aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-03-13 14:57:10 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-03-13 14:57:10 -0400
commita651578441d84a733aa2f5efc62315a3baccbc0a (patch)
treed097e2ff16f6e7a9d3ee9ac0a74e982fbb27d176 /gcc
parenta7af848991809005fee685e3fe15a39110136f3e (diff)
downloadgcc-a651578441d84a733aa2f5efc62315a3baccbc0a.zip
gcc-a651578441d84a733aa2f5efc62315a3baccbc0a.tar.gz
gcc-a651578441d84a733aa2f5efc62315a3baccbc0a.tar.bz2
PR c++/84839 - ICE with decltype of parameter pack.
* pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while instantiating dummy parms. From-SVN: r258500
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C9
3 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0da60a3..6e2958b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2018-03-13 Jason Merrill <jason@redhat.com>
+ PR c++/84839 - ICE with decltype of parameter pack.
+ * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
+ instantiating dummy parms.
+
* parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
parameter even without -Wpedantic.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 4640ca0..fdc1c9a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11717,7 +11717,9 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
{
/* This parameter pack was used in an unevaluated context. Just
make a dummy decl, since it's only used for its type. */
+ ++cp_unevaluated_operand;
arg_pack = tsubst_decl (parm_pack, args, complain);
+ --cp_unevaluated_operand;
if (arg_pack && DECL_PACK_P (arg_pack))
/* Partial instantiation of the parm_pack, we can't build
up an argument pack yet. */
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C
new file mode 100644
index 0000000..ce18f99
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C
@@ -0,0 +1,9 @@
+// PR c++/84839
+// { dg-do compile { target c++11 } }
+
+template<typename... T>
+struct S {
+ using fptr = void(*)(T... x, decltype(x)... y);
+};
+
+using F = S<int>::fptr;