diff options
author | Tom Tromey <tromey@redhat.com> | 2002-08-26 23:30:02 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2002-08-26 23:30:02 +0000 |
commit | 83dd5faeabc2ed171c4bba02cab19c75698dc450 (patch) | |
tree | 9dba3d59f4fcfb7a507c8215af1fdb4eae943891 /gcc/java | |
parent | d632dee9cb93ec0e45e070207046742019464d55 (diff) | |
download | gcc-83dd5faeabc2ed171c4bba02cab19c75698dc450.zip gcc-83dd5faeabc2ed171c4bba02cab19c75698dc450.tar.gz gcc-83dd5faeabc2ed171c4bba02cab19c75698dc450.tar.bz2 |
parse.y (try_builtin_assignconv): Allow narrowing primitive conversion if RHS_TYPE is byte, short, or char.
* parse.y (try_builtin_assignconv): Allow narrowing primitive
conversion if RHS_TYPE is byte, short, or char.
From-SVN: r56589
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/parse.y | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index fe4e8f2..dd5061b 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2002-08-26 Tom Tromey <tromey@redhat.com> + + * parse.y (try_builtin_assignconv): Allow narrowing primitive + conversion if RHS_TYPE is byte, short, or char. + 2002-08-22 Tom Tromey <tromey@redhat.com> * gcj.texi (Invoking gij): Document -cp and -classpath. diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 3dabe35..30a2dce 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)) { |