diff options
author | Bryce McKinlay <mckinlay@redhat.com> | 2004-08-02 21:20:46 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2004-08-02 22:20:46 +0100 |
commit | 899deeca6c931c4f4a21e73d40b623346d632fe9 (patch) | |
tree | 489c5ba70ebca4a8c68b6e6cfbbc6dd6343b586b /gcc | |
parent | 4c24b21a47dc8d146c8e4699e4b5a593a00fd9a9 (diff) | |
download | gcc-899deeca6c931c4f4a21e73d40b623346d632fe9.zip gcc-899deeca6c931c4f4a21e73d40b623346d632fe9.tar.gz gcc-899deeca6c931c4f4a21e73d40b623346d632fe9.tar.bz2 |
re PR java/16701 (Error when constant initializer depends on another constant with restricted access)
2004-08-02 Bryce McKinlay <mckinlay@redhat.com>
PR java/16701
* parse.y (fold_constant_for_init): Call resolve_field_access with
correct current_class context.
2004-08-02 Bryce McKinlay <mckinlay@redhat.com>
* testsuite/libjava.compile/PR16701.java: New test.
From-SVN: r85453
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/parse.y | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index b2c0a62..1cd9315 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2004-08-02 Bryce McKinlay <mckinlay@redhat.com> + + PR java/16701 + * parse.y (fold_constant_for_init): Call resolve_field_access with + correct current_class context. + 2004-08-01 Roger Sayle <roger@eyesopen.com> * decl.c (update_aliases, initialize_local_variable): Replace calls diff --git a/gcc/java/parse.y b/gcc/java/parse.y index c251f2f..fdff746 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -15970,16 +15970,16 @@ fold_constant_for_init (tree node, tree context) } else { - /* Install the proper context for the field resolution. - The prior context is restored once the name is - properly qualified. */ + tree r = NULL_TREE; + /* Install the proper context for the field resolution. */ tree saved_current_class = current_class; /* Wait until the USE_COMPONENT_REF re-write. FIXME. */ current_class = DECL_CONTEXT (context); qualify_ambiguous_name (node); + r = resolve_field_access (node, &decl, NULL); + /* Restore prior context. */ current_class = saved_current_class; - if (resolve_field_access (node, &decl, NULL) - && decl != NULL_TREE) + if (r != error_mark_node && decl != NULL_TREE) return fold_constant_for_init (decl, decl); return NULL_TREE; } |