aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y17
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 8a51483..7567c3d 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -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
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, found_decl, where_found, type_found)
type = TREE_TYPE (decl);
from_type = 1;
}
- /* We resolve and expression name */
+ /* We resolve an expression name */
else
{
tree field_decl = NULL_TREE;
@@ -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
container. The flag FROM_TYPE indicates that we resolved
the last member of the expression as a type name, which