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.
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)));
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;
}
2009-01-05 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/initlist12.C: Add another test.
+
* g++.dg/cpp0x/defaulted7.C: New test.
2009-01-05 Thomas Koenig <tkoenig@gcc.gnu.org>
};
U u({1,2}); // { dg-error "too many initializers" }
+
+union V {};
+
+V v({1}); // { dg-error "too many initializers" }