c-semantics.c (add_scope_stmt): Abort if the end SCOPE_STMT doesn't match the begin...
authorJason Merrill <jason@redhat.com>
Tue, 17 Dec 2002 06:24:02 +0000 (01:24 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 17 Dec 2002 06:24:02 +0000 (01:24 -0500)
        * c-semantics.c (add_scope_stmt): Abort if the end SCOPE_STMT
        doesn't match the begin SCOPE_STMT in partialness.

cp/
        * semantics.c (do_pushlevel): Call pushlevel after adding the
        SCOPE_STMT.
        (do_poplevel): Call poplevel before adding the SCOPE_STMT.
        * parse.y (function_body): Go back to using compstmt.
        * decl.c (pushdecl): Skip another level to get to the parms level.

        * call.c (build_new_method_call): Use is_dummy_object to determine
        whether or not to evaluate the object parameter to a static member
        function.

From-SVN: r60196

gcc/ChangeLog
gcc/c-semantics.c
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/decl.c
gcc/cp/parse.y
gcc/cp/semantics.c

index b9becce..dc1de48 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-16  Jason Merrill  <jason@redhat.com>
+
+       * c-semantics.c (add_scope_stmt): Abort if the end SCOPE_STMT
+       doesn't match the begin SCOPE_STMT in partialness.
+
 2002-12-16  Geoffrey Keating  <geoffk@apple.com>
 
        * genmultilib: Create temporary files in unique subdirectory.
index 0b8f587..77d7384 100644 (file)
@@ -146,6 +146,8 @@ add_scope_stmt (begin_p, partial_p)
     }
   else
     {
+      if (partial_p != SCOPE_PARTIAL_P (TREE_PURPOSE (top)))
+       abort ();
       TREE_VALUE (top) = ss;
       *stack_ptr = TREE_CHAIN (top);
     }
index ceafa26..a1b5038 100644 (file)
@@ -1,3 +1,15 @@
+2002-12-16  Jason Merrill  <jason@redhat.com>
+
+       * semantics.c (do_pushlevel): Call pushlevel after adding the
+       SCOPE_STMT.
+       (do_poplevel): Call poplevel before adding the SCOPE_STMT.
+       * parse.y (function_body): Go back to using compstmt.
+       * decl.c (pushdecl): Skip another level to get to the parms level.
+
+       * call.c (build_new_method_call): Use is_dummy_object to determine
+       whether or not to evaluate the object parameter to a static member
+       function.
+
 2002-12-14  Jason Merrill  <jason@redhat.com>
 
        * semantics.c (simplify_aggr_init_exprs_r): Also prepend the
index f766092..cafbb14 100644 (file)
@@ -4908,7 +4908,7 @@ build_new_method_call (tree instance, tree fns, tree args,
       call = build_over_call (cand, args, flags);
       /* In an expression of the form `a->f()' where `f' turns out to
         be a static member function, `a' is none-the-less evaluated.  */
-      if (instance && TREE_SIDE_EFFECTS (instance))
+      if (!is_dummy_object (instance_ptr) && TREE_SIDE_EFFECTS (instance))
        call = build (COMPOUND_EXPR, TREE_TYPE (call), instance, call);
     }
 
index e3f5b5a..2d6b4a4 100644 (file)
@@ -4161,6 +4161,9 @@ pushdecl (x)
                     them there.  */
                  struct cp_binding_level *b = current_binding_level->level_chain;
 
+                 /* Skip the ctor/dtor cleanup level.  */
+                 b = b->level_chain;
+
                  /* ARM $8.3 */
                  if (b->parm_flag == 1)
                    {
index 2f0fd93..4f62841 100644 (file)
@@ -798,15 +798,10 @@ eat_saved_input:
        ;
 
 /* The outermost block of a function really begins before the
-   mem-initializer-list, so we open one there and suppress the one that
-   actually corresponds to the curly braces.  */
+   mem-initializer-list, so we open one there, too.  */
 function_body:
-         begin_function_body_ ctor_initializer_opt save_lineno '{'
-               { $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
-         compstmtend
-                {
-                 STMT_LINENO ($<ttype>5) = $3;
-                 finish_compound_stmt (/*has_no_scope=*/1, $<ttype>5);
+         begin_function_body_ ctor_initializer_opt compstmt
+               {
                  finish_function_body ($1);
                }
        ;
index 1ceb1f3..763916a 100644 (file)
@@ -125,14 +125,17 @@ do_poplevel ()
     {
       tree scope_stmts = NULL_TREE;
 
-      if (!processing_template_decl)
-       scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
-
       block = poplevel (kept_level_p (), 1, 0);
-      if (block && !processing_template_decl)
+      if (!processing_template_decl)
        {
-         SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
-         SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
+         /* This needs to come after the poplevel so that partial scopes
+            are properly nested.  */
+         scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
+         if (block)
+           {
+             SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
+             SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
+           }
        }
     }
 
@@ -146,9 +149,9 @@ do_pushlevel ()
 {
   if (stmts_are_full_exprs_p ())
     {
-      pushlevel (0);
       if (!processing_template_decl)
        add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
+      pushlevel (0);
     }
 }