call.c (standard_conversion): Accept conversion between COMPLEX_TYPEs
2000-04-24 Gabriel Dos Reis <gdr@codesourcery.com> * call.c (standard_conversion): Accept conversion between COMPLEX_TYPEs * cvt.c (ocp_convert): Handle conversion to COMPLEX_TYPE From-SVN: r33396
This commit is contained in:
parent
b633b6c094
commit
a04678ca56
|
@ -1,3 +1,10 @@
|
|||
2000-04-24 Gabriel Dos Reis <gdr@codesourcery.com>
|
||||
|
||||
* call.c (standard_conversion): Accept conversion between
|
||||
COMPLEX_TYPEs
|
||||
|
||||
* cvt.c (ocp_convert): Handle conversion to COMPLEX_TYPE
|
||||
|
||||
2000-04-24 Zack Weinberg <zack@wolery.cumb.org>
|
||||
|
||||
* decl2.c (finish_file): Remove double setup for accounting
|
||||
|
|
|
@ -679,6 +679,26 @@ standard_conversion (to, from, expr)
|
|||
else if (fromref || (expr && real_lvalue_p (expr)))
|
||||
conv = build_conv (RVALUE_CONV, from, conv);
|
||||
|
||||
/* Allow conversion between `__complex__' data types */
|
||||
if (tcode == COMPLEX_TYPE && fcode == COMPLEX_TYPE)
|
||||
{
|
||||
/* The standard conversion sequence to convert FROM to TO is
|
||||
the standard conversion sequence to perform componentwise
|
||||
conversion. */
|
||||
tree part_conv = standard_conversion
|
||||
(TREE_TYPE (to), TREE_TYPE (from), NULL_TREE);
|
||||
|
||||
if (part_conv)
|
||||
{
|
||||
conv = build_conv (TREE_CODE (part_conv), to, conv);
|
||||
ICS_STD_RANK (conv) = ICS_STD_RANK (part_conv);
|
||||
}
|
||||
else
|
||||
conv = NULL_TREE;
|
||||
|
||||
return conv;
|
||||
}
|
||||
|
||||
if (same_type_p (from, to))
|
||||
return conv;
|
||||
|
||||
|
|
|
@ -692,6 +692,10 @@ ocp_convert (type, expr, convtype, flags)
|
|||
that can result in infinite recursion; fold will call
|
||||
convert, which will call ocp_convert, etc. */
|
||||
return e;
|
||||
/* For complex data types, we need to perform componentwise
|
||||
conversion. */
|
||||
else if (TREE_CODE (type) == COMPLEX_TYPE)
|
||||
return fold (convert_to_complex (type, e));
|
||||
else
|
||||
return fold (build1 (NOP_EXPR, type, e));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue