}
/* No type at all: default to `int', and set DEFAULTED_INT
because it was not a user-defined typedef. */
- if (type == NULL_TREE && (signed_p || unsigned_p || long_p || short_p))
+ if (type == NULL_TREE)
{
- /* These imply 'int'. */
- type = integer_type_node;
- defaulted_int = 1;
+ if (signed_p || unsigned_p || long_p || short_p)
+ {
+ /* These imply 'int'. */
+ type = integer_type_node;
+ defaulted_int = 1;
+ }
+ /* If we just have "complex", it is equivalent to "complex double". */
+ else if (!longlong && !explicit_intN
+ && decl_spec_seq_has_spec_p (declspecs, ds_complex))
+ {
+ type = double_type_node;
+ pedwarn (declspecs->locations[ds_complex], OPT_Wpedantic,
+ "ISO C++ does not support plain %<complex%> meaning "
+ "%<double complex%>");
+ }
}
/* Gather flags. */
explicit_int = declspecs->explicit_int_p;
{
if (TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE)
error ("complex invalid for %qs", name);
- /* If we just have "complex", it is equivalent to
- "complex double", but if any modifiers at all are specified it is
- the complex form of TYPE. E.g, "complex short" is
- "complex short int". */
- else if (defaulted_int && ! longlong && ! explicit_intN
- && ! (long_p || short_p || signed_p || unsigned_p))
- type = complex_double_type_node;
+ /* If a modifier is specified, the resulting complex is the complex
+ form of TYPE. E.g, "complex short" is "complex short int". */
else if (type == integer_type_node)
type = complex_integer_type_node;
else if (type == float_type_node)