diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-12-13 22:36:24 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-12-13 22:36:24 +0000 |
commit | 568aac9cf7c95ef4102838d126decf016d98ea46 (patch) | |
tree | 27f4bf893f61d052022eccda4447d0c5e56556cd /gcc/java | |
parent | 47bf5e3a3327688b007a6f038bc35cbb4e27f1c8 (diff) | |
download | gcc-568aac9cf7c95ef4102838d126decf016d98ea46.zip gcc-568aac9cf7c95ef4102838d126decf016d98ea46.tar.gz gcc-568aac9cf7c95ef4102838d126decf016d98ea46.tar.bz2 |
parse.y (java_complete_lhs): Only allow compound assignment of reference type if type is String.
* parse.y (java_complete_lhs): Only allow compound assignment of
reference type if type is String.
Co-Authored-By: Alexandre Petit-Bianco <apbianco@cygnus.com>
From-SVN: r38236
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/parse.y | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index d28b513..5ed93c7 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2000-11-20 Tom Tromey <tromey@cygnus.com> + Alexandre Petit-Bianco <apbianco@cygnus.com> + + * parse.y (java_complete_lhs): Only allow compound assignment of + reference type if type is String. + 2000-12-09 Alexandre Petit-Bianco <apbianco@cygnus.com> * Make-lang.in (java/jcf-path.o:): libgcj.jar replaces libgcj.zip. diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 9283e57..7761130 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -11608,6 +11608,14 @@ java_complete_lhs (node) nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), TREE_TYPE (lvalue), nn)); + /* If the assignment is compound and has reference type, + then ensure the LHS has type String and nothing else. */ + if (JREFERENCE_TYPE_P (TREE_TYPE (lvalue)) + && ! JSTRING_TYPE_P (TREE_TYPE (lvalue))) + parse_error_context (wfl_op2, + "Incompatible type for `+='. Can't convert `%s' to `java.lang.String'", + lang_printable_name (TREE_TYPE (lvalue), 0)); + /* 15.25.2.b: Left hand is an array access. FIXME */ } |