aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-10-08 17:05:50 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-10-08 17:05:50 -0400
commita41bb2c947782287f983daac7807f0e0e4ef4b65 (patch)
tree8628a0b80c9f68c17b56df8a9027d3a95a4b577d /gcc
parent024da3094e3bac0ed63bf0955e70557e61fc17f9 (diff)
downloadgcc-a41bb2c947782287f983daac7807f0e0e4ef4b65.zip
gcc-a41bb2c947782287f983daac7807f0e0e4ef4b65.tar.gz
gcc-a41bb2c947782287f983daac7807f0e0e4ef4b65.tar.bz2
re PR c++/63405 (ICE in cp_perform_integral_promotions, at cp/typeck.c:2084)
PR c++/63405 * pt.c (tsubst_pack_expansion): Limit simple expansion to type packs. From-SVN: r216013
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic162.C14
3 files changed, 24 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 975193d..1f9f412 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2014-10-08 Jason Merrill <jason@redhat.com>
+ PR c++/63405
+ * pt.c (tsubst_pack_expansion): Limit simple expansion to type packs.
+
PR c++/63485
* tree.c (build_cplus_array_type): Look for a type with no
typedef-name or attributes.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d1dddff..7d380e5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9929,7 +9929,13 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
/* If the expansion is just T..., return the matching argument pack. */
if (!unsubstituted_packs
&& TREE_PURPOSE (packs) == pattern)
- return ARGUMENT_PACK_ARGS (TREE_VALUE (packs));
+ {
+ tree args = ARGUMENT_PACK_ARGS (TREE_VALUE (packs));
+ if (TREE_CODE (t) == TYPE_PACK_EXPANSION
+ || pack_expansion_args_count (args))
+ return args;
+ /* Otherwise use the normal path so we get convert_from_reference. */
+ }
/* We cannot expand this expansion expression, because we don't have
all of the argument packs we need. */
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic162.C b/gcc/testsuite/g++.dg/cpp0x/variadic162.C
new file mode 100644
index 0000000..9e5386de
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic162.C
@@ -0,0 +1,14 @@
+// PR c++/63405
+// { dg-do compile { target c++11 } }
+
+template <typename _Tp> _Tp forward(_Tp);
+template <typename Args> struct Format { Format(int, Args); };
+template <typename... Args> auto format(Args &&... args) -> Format<Args...> {
+ return {0, args...};
+}
+
+template <typename... Args> void msg(Args... args) {
+ format(forward(args)...);
+}
+
+void some_function() { msg('x'); }