diff options
author | Geoffrey Keating <geoffk@apple.com> | 2005-03-24 23:33:56 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2005-03-24 23:33:56 +0000 |
commit | a10ce2f8eda6b4be3ffc432102b558a4cd055fb0 (patch) | |
tree | 00f93404319f492515942791b32145492be80b53 /gcc/cp | |
parent | a9f15d8302c4ab9dbe8e7233c9c9cc7699c2d950 (diff) | |
download | gcc-a10ce2f8eda6b4be3ffc432102b558a4cd055fb0.zip gcc-a10ce2f8eda6b4be3ffc432102b558a4cd055fb0.tar.gz gcc-a10ce2f8eda6b4be3ffc432102b558a4cd055fb0.tar.bz2 |
Index: cp/ChangeLog
2005-03-24 Geoffrey Keating <geoffk@apple.com>
* typeck.c (build_static_cast_1): Allow scalar_cast between
any integral, floating, or enumeration type.
Index: testsuite/ChangeLog
2005-03-24 Geoffrey Keating <geoffk@apple.com>
* g++.dg/expr/cast3.C: New.
From-SVN: r97019
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ae435c1..d769737 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-03-24 Geoffrey Keating <geoffk@apple.com> + + * typeck.c (build_static_cast_1): Allow scalar_cast between + any integral, floating, or enumeration type. + 2005-03-24 Steven Bosscher <stevenb@suse.de> * typeck.c (comptypes): First determine if the types are compatible diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index e2cb1f8..a3bf1c0 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4624,13 +4624,15 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p, promotions, floating point promotion, integral conversions, floating point conversions, floating-integral conversions, pointer conversions, and pointer to member conversions. */ - if ((ARITHMETIC_TYPE_P (type) && ARITHMETIC_TYPE_P (intype)) - /* DR 128 - - A value of integral _or enumeration_ type can be explicitly - converted to an enumeration type. */ - || (INTEGRAL_OR_ENUMERATION_TYPE_P (type) - && INTEGRAL_OR_ENUMERATION_TYPE_P (intype))) + /* DR 128 + + A value of integral _or enumeration_ type can be explicitly + converted to an enumeration type. */ + /* The effect of all that is that any conversion between any two + types which are integral, floating, or enumeration types can be + performed. */ + if ((INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type)) + && (INTEGRAL_TYPE_P (intype) || SCALAR_FLOAT_TYPE_P (intype))) { expr = ocp_convert (type, expr, CONV_C_CAST, LOOKUP_NORMAL); |