85th Cygnus<->FSF quick merge
authorMike Stump <mrs@gcc.gnu.org>
Fri, 22 Mar 1996 23:11:55 +0000 (23:11 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Fri, 22 Mar 1996 23:11:55 +0000 (23:11 +0000)
From-SVN: r11597

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/gxxint.texi
gcc/cp/pt.c
gcc/cp/typeck.c

index 3434665100c7b060bbc6659bbc2c2d8980bb76bc..fd4720c7228ec086791ff6b3974069f39d01f160 100644 (file)
@@ -1,3 +1,24 @@
+Fri Mar 22 13:48:29 1996  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (tsubst, case TYPE_DECL): Set DECL_CONTEXT.
+
+       * typeck.c (require_complete_type): Be sure to instantiate the
+       MAIN_VARIANT of the type.
+
+       * decl2.c (finish_file): Instantiate pending templates before
+       processing static constructors and destructors.
+
+       * pt.c (instantiate_decl): Don't instantiate functions at toplevel
+       unless at_eof.
+
+Fri Mar 22 09:30:17 1996  Bob Manson  <manson@beauty.cygnus.com>
+
+       * decl2.c (delete_sanity): If error_mark_node is passed
+       in as an expression, quit while we're ahead.
+
+       * decl.c (grokdeclarator): Give an error message if `friend'
+       is combined with any storage class specifiers.
+
 Wed Mar 20 14:51:55 1996  Jason Merrill  <jason@yorick.cygnus.com>
 
        * parse.y (named_complex_class_head_sans_basetype): Don't crash on
index 9855baca00562c9b1f9c494ee1b4c154987aecf7..10cf2a6504794cd8d415bf38aca1a9d6a22c895a 100644 (file)
@@ -8268,6 +8268,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
        error ("top-level declaration of `%s' specifies `auto'", name);
     }
 
+  if (nclasses > 0 && friendp)
+    error ("storage class specifiers invalid in friend function declarations");
+
   /* Now figure out the structure of the declarator proper.
      Descend through it, creating more complex types, until we reach
      the declared identifier (or NULL_TREE, in an absolute declarator).  */
index a902a4f473f8e53f7d7dda3ca4686402dc45476c..8077b5b252cf02e8cb69702d8d77595d93cda075 100644 (file)
@@ -1124,6 +1124,9 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
      this down as a NULL_TREE into build_vec_delete.  */
   tree maxindex = NULL_TREE;
 
+  if (exp == error_mark_node)
+    return exp;
+
   if (current_template_parms)
     {
       t = build_min (DELETE_EXPR, void_type_node, exp, size);
@@ -2822,10 +2825,6 @@ finish_file ()
 
   start_time = get_run_time ();
 
-  /* Push into C language context, because that's all
-     we'll need here.  */
-  push_lang_context (lang_name_c);
-
   /* Otherwise, GDB can get confused, because in only knows
      about source for LINENO-1 lines.  */
   lineno -= 1;
@@ -2833,6 +2832,16 @@ finish_file ()
   interface_unknown = 1;
   interface_only = 0;
 
+  for (fnname = pending_templates; fnname; fnname = TREE_CHAIN (fnname))
+    {
+      tree decl = TREE_VALUE (fnname);
+      instantiate_decl (decl);
+    }
+
+  /* Push into C language context, because that's all
+     we'll need here.  */
+  push_lang_context (lang_name_c);
+
 #if 1
   /* The reason for pushing garbage onto the global_binding_level is to
      ensure that we can slice out _DECLs which pertain to virtual function
@@ -3082,11 +3091,6 @@ finish_file ()
   if (flag_handle_signatures)
     walk_sigtables ((void (*)())0, finish_sigtable_vardecl);
 
-  for (fnname = pending_templates; fnname; fnname = TREE_CHAIN (fnname))
-    {
-      tree decl = TREE_VALUE (fnname);
-      instantiate_decl (decl);
-    }
   for (fnname = saved_inlines; fnname; fnname = TREE_CHAIN (fnname))
     {
       tree decl = TREE_VALUE (fnname);
index 64d9776cac2311559b2363d7387152bd75451819..5fedd5a94d0b3b22719393340800a0c9154782ac 100644 (file)
@@ -1226,7 +1226,7 @@ stands.
 
 Only exact type matching or reference matching of throw types works when
 -fno-rtti is used.  Only works on a SPARC (like Suns), i386, arm,
-rs6000, PowerPC, Alpha, mips, VAX, and m68k machines.  Partial support
+rs6000, PowerPC, Alpha, mips, VAX, m68k and z8k machines.  Partial support
 is in for all other machines, but a stack unwinder called
 __unwind_function has to be written, and added to libgcc2 for them.  The
 new EH code doesn't rely upon the __unwind_function for C++ code,
index 0ecc40018b0c7f416c7acc546c13c8a43ec4814c..f3307a1bb91f7326052f34285826c478daba8c0c 100644 (file)
@@ -1566,6 +1566,7 @@ tsubst (t, args, nargs, in_decl)
       {
        tree r = copy_node (t);
        TREE_TYPE (r) = type;
+       DECL_CONTEXT (r) = current_class_type;
        set_nested_typename (r, current_class_name, DECL_NAME (r), type);
        TREE_CHAIN (r) = NULL_TREE;
        return r;
@@ -2935,7 +2936,12 @@ instantiate_decl (d)
   if (! pattern_defined
       || (TREE_CODE (d) == FUNCTION_DECL && ! DECL_INLINE (d)
          && (! DECL_INTERFACE_KNOWN (d)
-             || ! DECL_NOT_REALLY_EXTERN (d))))
+             || ! DECL_NOT_REALLY_EXTERN (d)))
+      /* Kludge: if we compile a constructor in the middle of processing a
+         toplevel declaration, we blow away the declspecs in
+         temp_decl_obstack when we call permanent_allocation in
+         finish_function.  So don't compile it yet.  */
+      || (TREE_CODE (d) == FUNCTION_DECL && ! nested && ! at_eof))
     {
       add_pending_template (d);
       return d;
index 44e05b848b1a1ef6946391146f6cc0abf12b33f7..498f293c9c44122f117442efc74f8ff167570219 100644 (file)
@@ -112,7 +112,7 @@ require_complete_type (value)
 
   if (IS_AGGR_TYPE (type) && CLASSTYPE_TEMPLATE_INSTANTIATION (type))
     {
-      instantiate_class_template (type);
+      instantiate_class_template (TYPE_MAIN_VARIANT (type));
       if (TYPE_SIZE (type) != 0)
        return value;
     }