[PATCH] Java: fix to java/4141.
Alexandre Petit-Bianco
apbianco@cygnus.com
Tue Aug 28 19:21:00 GMT 2001
This fixes java/4141. It's been tested, I'm checking this in.
./A
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
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.303
diff -u -p -r1.303 parse.y
--- parse.y 2001/08/27 14:46:57 1.303
+++ parse.y 2001/08/29 02:20:12
@@ -9617,10 +9617,9 @@ resolve_qualified_expression_name (wfl,
/* We have a type name. It's been already resolved when the
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)))
- return 1; /* Error reported already */
+ decl = QUAL_RESOLUTION (q);
/* Sneak preview. If next we see a `new', we're facing a
qualification with resulted in a type being selected
@@ -9648,7 +9647,7 @@ resolve_qualified_expression_name (wfl,
type = TREE_TYPE (decl);
from_type = 1;
}
- /* We resolve and expression name */
+ /* We resolve an expression name */
else
{
tree field_decl = NULL_TREE;
@@ -9682,6 +9681,16 @@ resolve_qualified_expression_name (wfl,
*where_found = TREE_TYPE (*where_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
More information about the Gcc-patches
mailing list