aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2008-02-15 03:09:18 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2008-02-15 03:09:18 +0000
commit625b6d91e7fed284c8228c333340ebf7ba6b479a (patch)
treeb1217c8cd8434e9df01019e65abc92a3b7e3ec04
parent512d1f4b7da783c91f11453b42fedbdb3a01465e (diff)
downloadgcc-625b6d91e7fed284c8228c333340ebf7ba6b479a.zip
gcc-625b6d91e7fed284c8228c333340ebf7ba6b479a.tar.gz
gcc-625b6d91e7fed284c8228c333340ebf7ba6b479a.tar.bz2
re PR c++/34050 (ICE derived classes and variadic templates)
2008-02-14 Douglas Gregor <doug.gregor@gmail.com> PR c++/34050 * pt.c (tsubst_initializer_list): Deal with the use of VOID_TYPE_NODE to indicate value-initialization of the bases. 2008-02-14 Douglas Gregor <doug.gregor@gmail.com> PR c++/34050 * g++.dg/cpp0x/vt-34050.C: New. From-SVN: r132331
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c72
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/vt-34050.C9
4 files changed, 62 insertions, 30 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3635512..3853983 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-14 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/34050
+ * pt.c (tsubst_initializer_list): Deal with the use of
+ VOID_TYPE_NODE to indicate value-initialization of the bases.
+
2008-02-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
Jason Merrill <jason@redhat.com>
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2e2a636..d11a959 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15190,37 +15190,49 @@ tsubst_initializer_list (tree t, tree argvec)
PACK_EXPANSION_PARAMETER_PACKS (expr) =
PACK_EXPANSION_PARAMETER_PACKS (TREE_PURPOSE (t));
- /* Substitute parameter packs into each argument in the
- TREE_LIST. */
- in_base_initializer = 1;
- for (arg = TREE_VALUE (t); arg; arg = TREE_CHAIN (arg))
- {
- tree expanded_exprs;
-
- /* Expand the argument. */
- SET_PACK_EXPANSION_PATTERN (expr, TREE_VALUE (arg));
- expanded_exprs = tsubst_pack_expansion (expr, argvec,
- tf_warning_or_error,
- NULL_TREE);
-
- /* Prepend each of the expanded expressions to the
- corresponding TREE_LIST in EXPANDED_ARGUMENTS. */
- for (i = 0; i < len; i++)
- {
- TREE_VEC_ELT (expanded_arguments, i) =
- tree_cons (NULL_TREE, TREE_VEC_ELT (expanded_exprs, i),
- TREE_VEC_ELT (expanded_arguments, i));
- }
- }
- in_base_initializer = 0;
+ if (TREE_VALUE (t) == void_type_node)
+ /* VOID_TYPE_NODE is used to indicate
+ value-initialization. */
+ {
+ for (i = 0; i < len; i++)
+ TREE_VEC_ELT (expanded_arguments, i) = void_type_node;
+ }
+ else
+ {
+ /* Substitute parameter packs into each argument in the
+ TREE_LIST. */
+ in_base_initializer = 1;
+ for (arg = TREE_VALUE (t); arg; arg = TREE_CHAIN (arg))
+ {
+ tree expanded_exprs;
+
+ /* Expand the argument. */
+ SET_PACK_EXPANSION_PATTERN (expr, TREE_VALUE (arg));
+ expanded_exprs
+ = tsubst_pack_expansion (expr, argvec,
+ tf_warning_or_error,
+ NULL_TREE);
+
+ /* Prepend each of the expanded expressions to the
+ corresponding TREE_LIST in EXPANDED_ARGUMENTS. */
+ for (i = 0; i < len; i++)
+ {
+ TREE_VEC_ELT (expanded_arguments, i) =
+ tree_cons (NULL_TREE,
+ TREE_VEC_ELT (expanded_exprs, i),
+ TREE_VEC_ELT (expanded_arguments, i));
+ }
+ }
+ in_base_initializer = 0;
- /* Reverse all of the TREE_LISTs in EXPANDED_ARGUMENTS,
- since we built them backwards. */
- for (i = 0; i < len; i++)
- {
- TREE_VEC_ELT (expanded_arguments, i) =
- nreverse (TREE_VEC_ELT (expanded_arguments, i));
- }
+ /* Reverse all of the TREE_LISTs in EXPANDED_ARGUMENTS,
+ since we built them backwards. */
+ for (i = 0; i < len; i++)
+ {
+ TREE_VEC_ELT (expanded_arguments, i) =
+ nreverse (TREE_VEC_ELT (expanded_arguments, i));
+ }
+ }
}
for (i = 0; i < len; ++i)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4c1c8b8..792ae4c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-14 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/34050
+ * g++.dg/cpp0x/vt-34050.C: New.
+
2008-02-14 Danny Smith <dannysmith@users.sourceforge.net>
PR preprocessor/35061
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34050.C b/gcc/testsuite/g++.dg/cpp0x/vt-34050.C
new file mode 100644
index 0000000..cb19b39
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34050.C
@@ -0,0 +1,9 @@
+// { dg-options "-std=c++0x" }
+struct A {};
+
+template<typename... T> struct B : T...
+{
+ B() : T()... {}
+};
+
+B<A> b;