aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-01-05 22:27:39 -0500
committerJason Merrill <jason@gcc.gnu.org>2009-01-05 22:27:39 -0500
commit9bfea41b05947073cce682a8a6cf14924064fbde (patch)
tree9733822ded9e2fc2f88167786037c4eadb498da2 /gcc/cp
parent77d96a79bfcc66cba3e59bee6b80477c5bd08df2 (diff)
downloadgcc-9bfea41b05947073cce682a8a6cf14924064fbde.zip
gcc-9bfea41b05947073cce682a8a6cf14924064fbde.tar.gz
gcc-9bfea41b05947073cce682a8a6cf14924064fbde.tar.bz2
re PR c++/38698 (ICE initializing union with initializer list)
PR c++/38698 * typeck2.c (process_init_constructor_union): Handle union with no fields. * mangle.c (write_expression): Remove mangling for zero-operand casts. From-SVN: r143111
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/mangle.c8
-rw-r--r--gcc/cp/typeck2.c6
3 files changed, 16 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cc4fce1..1e85539 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -5,6 +5,13 @@
2009-01-05 Jason Merrill <jason@redhat.com>
+ PR c++/38698
+ * typeck2.c (process_init_constructor_union): Handle union with
+ no fields.
+
+ * mangle.c (write_expression): Remove mangling for zero-operand
+ casts.
+
PR c++/38701
* decl.c (cp_finish_decl): Clear DECL_INITIAL for invalid
defaulting.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 1ec27c1..a7b4662 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2348,12 +2348,12 @@ write_expression (tree expr)
case CAST_EXPR:
write_type (TREE_TYPE (expr));
+ /* There is no way to mangle a zero-operand cast like
+ "T()". */
if (!TREE_OPERAND (expr, 0))
- /* "T()" is mangled as "T(void)". */
- write_char ('v');
+ sorry ("zero-operand casts cannot be mangled due to a defect "
+ "in the C++ ABI");
else if (list_length (TREE_OPERAND (expr, 0)) > 1)
- /* FIXME the above hack for T() needs to be replaced with
- something more general. */
sorry ("mangling function-style cast with more than one argument");
else
write_expression (TREE_VALUE (TREE_OPERAND (expr, 0)));
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index e313e4b..60e4ef1 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1147,7 +1147,11 @@ process_init_constructor_union (tree type, tree init)
tree field = TYPE_FIELDS (type);
while (field && (!DECL_NAME (field) || TREE_CODE (field) != FIELD_DECL))
field = TREE_CHAIN (field);
- gcc_assert (field);
+ if (field == NULL_TREE)
+ {
+ error ("too many initializers for %qT", type);
+ ce->value = error_mark_node;
+ }
ce->index = field;
}