decl.c (saved_scope_p): New fn.
authorJason Merrill <jason@yorick.cygnus.com>
Fri, 17 Sep 1999 01:44:05 +0000 (01:44 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 17 Sep 1999 01:44:05 +0000 (21:44 -0400)
* decl.c (saved_scope_p): New fn.
* class.c (pushclass): Don't clear class_cache_obstack if we have
saved scopes.

From-SVN: r29468

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl.c

index 7603401c4fccc3f22d0643a3a4d45bab0159defa..3f7d508db23096c836915599e627f7c4077555ea 100644 (file)
@@ -1,3 +1,9 @@
+1999-09-16  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (saved_scope_p): New fn.
+       * class.c (pushclass): Don't clear class_cache_obstack if we have
+       saved scopes.
+
 1999-09-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero.
index 2c6a03f71562085e43f48ed60509e5eb4d3945d9..3b63503c5c0757929edbad0ba1cdef1e5b0c8a2d 100644 (file)
@@ -4499,11 +4499,16 @@ pushclass (type, modify)
       /* Forcibly remove any old class remnants.  */
       invalidate_class_lookup_cache ();
 
-      /* Now, free the obstack on which we cached all the values.  */
-      if (class_cache_firstobj)
-       obstack_free (&class_cache_obstack, class_cache_firstobj);
-      class_cache_firstobj 
-       = (char*) obstack_finish (&class_cache_obstack);
+      /* Now, free the obstack on which we cached all the values.
+         We can't do this if we have saved scopes sitting around, since
+        they may have saved previous_class_values.  */
+      if (! saved_scope_p ())
+       {
+         if (class_cache_firstobj)
+           obstack_free (&class_cache_obstack, class_cache_firstobj);
+         class_cache_firstobj 
+           = (char*) obstack_finish (&class_cache_obstack);
+       }
     }
 
   /* If we're about to enter a nested class, clear
index cd42511d5e1d3a8d88921ce0770f102230510a54..d8ad184cc2ff001395b0f28888a825b77ba673f5 100644 (file)
@@ -2481,6 +2481,12 @@ pop_from_top_level ()
 
   free (s);
 }
+
+int
+saved_scope_p ()
+{
+  return current_saved_scope != NULL;
+}
 \f
 /* Push a definition of struct, union or enum tag "name".
    into binding_level "b".   "type" should be the type node,