re PR java/4141 (GCJ compiles illegal code without complaining.)

2001-08-27  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* parse.y (resolve_qualified_expression_name): Handle unresolved
	qualified expressions, prevent numerical qualifiers, fixed typo.
	Fixes PR java/4141

(http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01644.html)

From-SVN: r45251
parent 51a25585
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
* jcf-write.c (generate_bytecode_insns): Generate an integer to * jcf-write.c (generate_bytecode_insns): Generate an integer to
real conversion for increments and decrements of reals. real conversion for increments and decrements of reals.
2001-08-27 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (resolve_qualified_expression_name): Handle unresolved
qualified expressions, prevent numerical qualifiers, fixed typo.
Fixes PR java/4141
2001-08-24 Alexandre Petit-Bianco <apbianco@redhat.com> 2001-08-24 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (check_deprecation): Handle TYPE_DECL in a special case, * parse.y (check_deprecation): Handle TYPE_DECL in a special case,
...@@ -37,6 +43,7 @@ ...@@ -37,6 +43,7 @@
descriptor. descriptor.
* class.c (make_method_value): Compute `throws' field for method. * class.c (make_method_value): Compute `throws' field for method.
>>>>>>> 1.790
2001-08-22 Alexandre Petit-Bianco <apbianco@redhat.com> 2001-08-22 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (resolve_inner_class): Keep local_enclosing to NULL if * parse.y (resolve_inner_class): Keep local_enclosing to NULL if
...@@ -62,6 +69,7 @@ ...@@ -62,6 +69,7 @@
superclass if necessary. superclass if necessary.
Fixes PR java/4007 Fixes PR java/4007
>>>>>>> 1.785
2001-08-16 Tom Tromey <tromey@redhat.com> 2001-08-16 Tom Tromey <tromey@redhat.com>
* jcf-dump.c (main): Updated for change to jcf_path_seal. * jcf-dump.c (main): Updated for change to jcf_path_seal.
......
...@@ -9617,10 +9617,9 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -9617,10 +9617,9 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
/* We have a type name. It's been already resolved when the /* We have a type name. It's been already resolved when the
expression was qualified. */ expression was qualified. */
else if (RESOLVE_TYPE_NAME_P (qual_wfl)) else if (RESOLVE_TYPE_NAME_P (qual_wfl) && QUAL_RESOLUTION (q))
{ {
if (!(decl = QUAL_RESOLUTION (q))) decl = QUAL_RESOLUTION (q);
return 1; /* Error reported already */
/* Sneak preview. If next we see a `new', we're facing a /* Sneak preview. If next we see a `new', we're facing a
qualification with resulted in a type being selected qualification with resulted in a type being selected
...@@ -9648,7 +9647,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -9648,7 +9647,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
type = TREE_TYPE (decl); type = TREE_TYPE (decl);
from_type = 1; from_type = 1;
} }
/* We resolve and expression name */ /* We resolve an expression name */
else else
{ {
tree field_decl = NULL_TREE; tree field_decl = NULL_TREE;
...@@ -9684,6 +9683,16 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -9684,6 +9683,16 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
} }
} }
/* Report and error if we're using a numerical litteral as a
qualifier. It can only be an INTEGER_CST. */
else if (TREE_CODE (qual_wfl) == INTEGER_CST)
{
parse_error_context
(wfl, "Can't use type `%s' as a qualifier",
lang_printable_name (TREE_TYPE (qual_wfl), 0));
return 1;
}
/* We have to search for a field, knowing the type of its /* We have to search for a field, knowing the type of its
container. The flag FROM_TYPE indicates that we resolved container. The flag FROM_TYPE indicates that we resolved
the last member of the expression as a type name, which the last member of the expression as a type name, which
......
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