diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-26 23:30:02 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-26 23:30:02 +0000 |
commit | 263623d076149c6dcc9e9cc6b2028fe3359a961c (patch) | |
tree | 9dba3d59f4fcfb7a507c8215af1fdb4eae943891 /gcc/java/parse.y | |
parent | fa938c8f4e9f54b17958495d89727d2da08f4d2f (diff) | |
download | gcc-263623d076149c6dcc9e9cc6b2028fe3359a961c.tar.gz |
* parse.y (try_builtin_assignconv): Allow narrowing primitive
conversion if RHS_TYPE is byte, short, or char.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56589 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r-- | gcc/java/parse.y | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 3dabe3593d0..30a2dce28ac 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -12915,11 +12915,14 @@ try_builtin_assignconv (wfl_op1, lhs_type, rhs) new_rhs = convert (lhs_type, rhs); /* Try a narrowing primitive conversion (5.1.3): - - expression is a constant expression of type int AND + - expression is a constant expression of type byte, short, char, + or int, AND - variable is byte, short or char AND - The value of the expression is representable in the type of the variable */ - else if (rhs_type == int_type_node && TREE_CONSTANT (rhs) + else if ((rhs_type == byte_type_node || rhs_type == short_type_node + || rhs_type == char_type_node || rhs_type == int_type_node) + && TREE_CONSTANT (rhs) && (lhs_type == byte_type_node || lhs_type == char_type_node || lhs_type == short_type_node)) { |