]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
parse.y (try_builtin_assignconv): Allow narrowing primitive conversion if RHS_TYPE...
authorTom Tromey <tromey@redhat.com>
Mon, 26 Aug 2002 23:30:02 +0000 (23:30 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Mon, 26 Aug 2002 23:30:02 +0000 (23:30 +0000)
* parse.y (try_builtin_assignconv): Allow narrowing primitive
conversion if RHS_TYPE is byte, short, or char.

From-SVN: r56589

gcc/java/ChangeLog
gcc/java/parse.y

index fe4e8f2cbbc1b14ffd965a61d43219da8e65dbbf..dd5061b76ac57a561aafa16a67bfb1ffa2aeb6d2 100644 (file)
@@ -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.
index 3dabe3593d0ff0cdf26aab515e0c7c1d62644308..30a2dce28ac8089e0f42d68c19934ccc9e3f47f8 100644 (file)
@@ -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))
     {