aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@codesourcery.com>2000-04-25 00:11:34 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2000-04-25 00:11:34 +0000
commita04678ca5666102eca111375a79c7e209663b2f1 (patch)
treef56014c79f0a2ccea3a08aa31e6271f4994dd52c /gcc
parentb633b6c0947aa4201a31fb17869fb5157471f58f (diff)
downloadgcc-a04678ca5666102eca111375a79c7e209663b2f1.zip
gcc-a04678ca5666102eca111375a79c7e209663b2f1.tar.gz
gcc-a04678ca5666102eca111375a79c7e209663b2f1.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/call.c20
-rw-r--r--gcc/cp/cvt.c4
3 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fbd1d33..295be19 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 085e264..d8dda3e 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -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;
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 8f501c0..376cdaa 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -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));
}