Commit 899deeca by Bryce McKinlay Committed by Bryce McKinlay

re PR java/16701 (Error when constant initializer depends on another constant…

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
parent 4c24b21a
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> 2004-08-01 Roger Sayle <roger@eyesopen.com>
* decl.c (update_aliases, initialize_local_variable): Replace calls * decl.c (update_aliases, initialize_local_variable): Replace calls
......
...@@ -15970,16 +15970,16 @@ fold_constant_for_init (tree node, tree context) ...@@ -15970,16 +15970,16 @@ fold_constant_for_init (tree node, tree context)
} }
else else
{ {
/* Install the proper context for the field resolution. tree r = NULL_TREE;
The prior context is restored once the name is /* Install the proper context for the field resolution. */
properly qualified. */
tree saved_current_class = current_class; tree saved_current_class = current_class;
/* Wait until the USE_COMPONENT_REF re-write. FIXME. */ /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
current_class = DECL_CONTEXT (context); current_class = DECL_CONTEXT (context);
qualify_ambiguous_name (node); qualify_ambiguous_name (node);
r = resolve_field_access (node, &decl, NULL);
/* Restore prior context. */
current_class = saved_current_class; current_class = saved_current_class;
if (resolve_field_access (node, &decl, NULL) if (r != error_mark_node && decl != NULL_TREE)
&& decl != NULL_TREE)
return fold_constant_for_init (decl, decl); return fold_constant_for_init (decl, decl);
return NULL_TREE; return NULL_TREE;
} }
......
2004-08-02 Bryce McKinlay <mckinlay@redhat.com>
* testsuite/libjava.compile/PR16701.java: New test.
2004-08-01 Andrew John Hughes <gnu_andrew@member.fsf.org> 2004-08-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/Collection.java, java/util/List.java, * java/util/Collection.java, java/util/List.java,
......
class Cl
{
private static final int CONSTANT1 = 0x001;
public static final int CONSTANT2 = 0x002 >> CONSTANT1;
}
public class PR16701
{
public static final int VALUE = Cl.CONSTANT2;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment