This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Patch to fix net PR #48


I checked in this patch to fix the net PR #48:

  http://sourceware.cygnus.com/ml/java-prs/1999-q3/msg00106.html

./A

Mon Nov  1 01:32:48 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (resolve_qualified_expression_name): Prevent `this' from
 	being used before the superclass constructor has been called.
	(complete_function_arguments): Use CALL_EXPLICIT_CONSTRUCTOR_P
 	instead of `CALL_THIS_CONSTRUCTOR_P'.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.115
diff -u -p -r1.115 parse.y
--- parse.y	1999/10/29 21:32:28	1.115
+++ parse.y	1999/11/01 09:37:46
@@ -6725,6 +6725,12 @@ resolve_qualified_expression_name (wfl, 
 		(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;
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]