+2007-04-24 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/31388
+ * cp-tree.h (ARITHMETIC_TYPE): Include COMPLEX_TYPE.
+ * typeck.c (type_after_usual_arithmetic_conversions): Adjust, as
+ COMPLEX_TYPE is now an ARITHMETIC_TYPE.
+ * init.c (build_zero_init): Adjust, as
+ COMPLEX_TYPE is now a SCALAR_TYPE.
+ * typeck2.c (digest_init): Allow brace-enclosed initializers for
+ COMPLEX_TYPE, even though that is now a SCALAR_TYPE.
+
2007-04-25 Paolo Carlini <pcarlini@suse.de>
* semantics.c (classtype_has_nothrow_copy_or_assign_p): Adjust
/* [basic.fundamental]
Integral and floating types are collectively called arithmetic
- types. Keep these checks in ascending code order. */
+ types.
+
+ As a GNU extension, we also accept complex types.
+
+ Keep these checks in ascending code order. */
#define ARITHMETIC_TYPE_P(TYPE) \
- (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
+ (CP_INTEGRAL_TYPE_P (TYPE) \
+ || TREE_CODE (TYPE) == REAL_TYPE \
+ || TREE_CODE (TYPE) == COMPLEX_TYPE)
/* [basic.types]
Arithmetic types, enumeration types, pointer types, and
pointer-to-member types, are collectively called scalar types.
+
Keep these checks in ascending code order. */
#define SCALAR_TYPE_P(TYPE) \
(TYPE_PTRMEM_P (TYPE) \
items with static storage duration that are not otherwise
initialized are initialized to zero. */
;
- else if (SCALAR_TYPE_P (type)
- || TREE_CODE (type) == COMPLEX_TYPE)
+ else if (SCALAR_TYPE_P (type))
init = convert (type, integer_zero_node);
else if (CLASS_TYPE_P (type))
{
/* FIXME: Attributes. */
gcc_assert (ARITHMETIC_TYPE_P (t1)
- || TREE_CODE (t1) == COMPLEX_TYPE
|| TREE_CODE (t1) == VECTOR_TYPE
|| TREE_CODE (t1) == ENUMERAL_TYPE);
gcc_assert (ARITHMETIC_TYPE_P (t2)
- || TREE_CODE (t2) == COMPLEX_TYPE
|| TREE_CODE (t2) == VECTOR_TYPE
|| TREE_CODE (t2) == ENUMERAL_TYPE);
code2 = TREE_CODE (t2);
if ((ARITHMETIC_TYPE_P (t1) || code1 == ENUMERAL_TYPE
- || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)
+ || code1 == VECTOR_TYPE)
&& (ARITHMETIC_TYPE_P (t2) || code2 == ENUMERAL_TYPE
- || code2 == COMPLEX_TYPE || code2 == VECTOR_TYPE))
+ || code2 == VECTOR_TYPE))
return type_after_usual_arithmetic_conversions (t1, t2);
else if ((TYPE_PTR_P (t1) && TYPE_PTR_P (t2))
}
/* Handle scalar types (including conversions) and references. */
- if (SCALAR_TYPE_P (type) || code == REFERENCE_TYPE)
+ if (TREE_CODE (type) != COMPLEX_TYPE
+ && (SCALAR_TYPE_P (type) || code == REFERENCE_TYPE))
return convert_for_initialization (0, type, init, LOOKUP_NORMAL,
"initialization", NULL_TREE, 0);
--- /dev/null
+// PR c++/31388
+// { dg-options "" }
+
+bool b = !0i;
+