aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@cygnus.com>1999-11-01 09:45:18 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>1999-11-01 01:45:18 -0800
commitf63991a86a5645740cece5ff81981df9cff86d71 (patch)
tree1ce1bf40843d04ca1d2d20346b636dfcc66fe602 /gcc/java/parse.y
parente5de8c72837aa699f506820ab4020e2b7bf39437 (diff)
downloadgcc-f63991a86a5645740cece5ff81981df9cff86d71.zip
gcc-f63991a86a5645740cece5ff81981df9cff86d71.tar.gz
gcc-f63991a86a5645740cece5ff81981df9cff86d71.tar.bz2
re GNATS gcj/48 (Compiler fails to catch constructor problem)
Mon Nov 1 01:32:48 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> * parse.y (resolve_qualified_expression_name): Prevent `this' from being before the superclass constructor has been called. (This fixes the net PR #48: http://sourceware.cygnus.com/ml/java-prs/1999-q3/msg00106.html) From-SVN: r30317
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 8773014..aa53706 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -6725,6 +6725,12 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
(wfl, "Keyword `this' used outside allowed context");
return 1;
}
+ if (ctxp->explicit_constructor_p)
+ {
+ parse_error_context (wfl, "Can't reference `this' before the "
+ "superclass constructor has been called");
+ return 1;
+ }
/* We have to generate code for intermediate acess */
*where_found = decl = current_this;
*type_found = type = QUAL_DECL_TYPE (decl);
@@ -8732,7 +8738,7 @@ complete_function_arguments (node)
int flag = 0;
tree cn;
- ctxp->explicit_constructor_p += (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
+ ctxp->explicit_constructor_p += (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
{
tree wfl = TREE_VALUE (cn), parm, temp;
@@ -8752,7 +8758,7 @@ complete_function_arguments (node)
TREE_VALUE (cn) = parm;
}
- ctxp->explicit_constructor_p -= (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0);
+ ctxp->explicit_constructor_p -= (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
return flag;
}