OSDN Git Service

90th Cygnus<->FSF quick merge
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Dec 1996 02:46:25 +0000 (02:46 +0000)
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Dec 1996 02:46:25 +0000 (02:46 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13321 138bc75d-0d04-0410-961f-82ee72b054a4

18 files changed:
gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/error.c
gcc/cp/init.c
gcc/cp/lex.c
gcc/cp/method.c
gcc/cp/parse.y
gcc/cp/pt.c
gcc/cp/search.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/cp/typeck2.c

index 1a2aaee..c178546 100644 (file)
@@ -1,3 +1,92 @@
+Mon Dec 16 22:43:31 1996  Brendan Kehoe  <brendan@lisa.cygnus.com>
+
+       * cp-tree.h (ptr_reasonably_similar): Add decl.
+
+Thu Dec 12 15:00:35 1996  Brendan Kehoe  <brendan@lisa.cygnus.com>
+
+       * decl.c (grokvardecl): Change SPECBITS parm to be the SPECBITS_IN
+       pointer.  New local SPECBITS with the parm's value.
+       (grokdeclarator): Pass &specbits down.
+
+       * parse.y (expr_no_commas): Make sure $$ is not an error_mark_node
+       before we try to do C_SET_EXP_ORIGINAL_CODE on it.
+
+       * search.c (envelope_add_decl): Check that the CLASSTYPE_CID of
+       CONTEXT is not 0 before we try to use TYPE_DERIVES_FROM.
+
+       * decl.c (cplus_expand_expr_stmt): Only expand the expr if EXP is
+       not an error_mark_node.
+
+Sat Dec  7 17:20:22 1996  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * cp-tree.h (TYPE_MAIN_DECL): Use TYPE_STUB_DECL.
+       * *.c: Use TYPE_MAIN_DECL instead of TYPE_NAME where appropriate.
+       
+Fri Dec  6 14:40:09 1996  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (grokdeclarator): When giving an anonymous struct a name,
+       replace TYPE_NAME instead of TYPE_IDENTIFIER (so TYPE_STUB_DECL is
+       not affected).
+
+       * typeck2.c (build_m_component_ref): If component is a pointer
+       to data member, resolve the OFFSET_REF now.
+
+       * call.c (convert_like): Don't go into infinite recursion.
+
+       * pt.c (coerce_template_parms): Use tsubst_expr for non-type args.
+
+       * class.c (finish_struct_1): Set DECL_ARTIFICIAL on the vptr.
+       * tree.c (layout_basetypes): And on the vbase ptr.
+
+Thu Dec  5 02:11:28 1996  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (BOOL_TYPE_SIZE): Define in terms of POINTER_SIZE or
+       CHAR_TYPE_SIZE so bool is always the same size as another type.
+
+       * decl.c (pushtag): Set DECL_IGNORED_P for DWARF, too.
+
+Tue Dec  3 23:18:37 1996  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl2.c (grok_x_components): Remove synthesized methods from
+       TYPE_METHODS of an anonymous union, complain about member
+       functions.
+       * decl.c (shadow_tag): Wipe out memory of synthesized methods in
+       anonymous unions.
+       (finish_function): Just clear the DECL_RTL of our arguments.
+
+Fri Nov 29 21:54:17 1996  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl2.c (finish_file): Emit DWARF debugging info for static data
+       members.
+
+       * pt.c (tsubst): If t is a stub decl, return the stub decl for type.
+
+Wed Nov 27 14:47:15 1996  Bob Manson  <manson@charmed.cygnus.com>
+
+       * typeck.c (build_component_ref): Don't die if COMPONENT isn't a
+       IDENTIFIER_NODE.
+
+Wed Nov 27 16:05:19 1996  Michael Meissner  <meissner@tiktok.cygnus.com>
+
+       * Make-lang.in (g++-cross$(exeext)): Fix typo.
+
+Wed Nov 27 08:14:00 1996  Brendan Kehoe  <brendan@lisa.cygnus.com>
+
+       Make the g++ driver now be a standalone program, rather than one
+       that tries to run the gcc driver after munging up the options.
+       * Make-lang.in (g++.c, g++spec.o): New rules.
+       (g++.o): New rule, based on gcc.o with -DLANG_SPECIFIC_DRIVER
+       added.
+       (g++$(exeext)): New rule, based on xgcc rule.
+       (g++-cross$(exeext)): Now just copies g++$(exeext) over.
+       * g++spec.c: New file.
+       * g++.c: Removed file.
+
+Tue Nov 26 19:01:09 1996  Mike Stump  <mrs@cygnus.com>
+
+       * cvt.c (build_up_reference): Arrange for any temporary values
+       that have been keep in registers until now to be put into memory.
+
 Mon Nov 25 15:16:41 1996  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Make-lang.in (c++.stage[1234]): Depend upon stage[1-4]-start, so
@@ -12,8 +101,6 @@ Thu Nov 21 16:30:24 1996  Jason Merrill  <jason@yorick.cygnus.com>
        * typeck.c (c_expand_return): Fix logic.
        (unary_complex_lvalue): Avoid unused warning on address of INIT_EXPR.
 
-       * decl.c (grokfndecl): Also note_debug_info_needed on ctype here.
-
 Wed Nov 20 18:47:31 1996  Bob Manson  <manson@charmed.cygnus.com>
 
        * g++.c (main): Make sure arglist has a final NULL entry.  Add
@@ -186,20 +273,10 @@ Mon Nov 11 13:20:34 1996  Bob Manson  <manson@charmed.cygnus.com>
 Fri Nov  8 17:38:44 1996  Jason Merrill  <jason@yorick.cygnus.com>
 
        * decl2.c (finish_file): Don't emit debug info.
-       * decl.c (start_function): Call note_debug_info_needed for context.
-       (start_decl): Likewise.
-       (cp_finish_decl): Not here.
-       (finish_function): Or here.
-       (pushdecl): Lose obsolete code.
+       * decl.c (pushdecl): Lose obsolete code.
        (grokdeclarator): Still do the long long thing after complaining.
-       (finish_enum): Don't call rest_of_type_compilation
-       for DWARF.
-       * class.c (finish_struct_1): Don't call rest_of_type_compilation
-       for DWARF.
-       * search.c (dfs_debug_mark): For DWARF, just call
-       rest_of_type_compilation.
-       (note_debug_info_needed): Don't do anything if we're in a template.
-       * parse.y (named_complex_class_head_sans_basetype): Likewise.
+       * search.c (note_debug_info_needed): Don't do anything if we're in a 
+       template.
        * method.c (synthesize_method): For non-local classes,
        push_to_top_level first.
 
index 45037eb..c4400b3 100644 (file)
@@ -71,14 +71,32 @@ C++ c++: cc1plus
 # Tell GNU make to ignore these if they exist.
 .PHONY: C++ c++
 
+g++.c: $(srcdir)/gcc.c
+       -rm -f $@
+       ln -s $(srcdir)/gcc.c $@ || cp $(srcdir)/gcc.c $@
+
+g++spec.o: $(srcdir)/cp/g++spec.c
+       $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+# N.B.: This is a copy of the gcc.o rule, with -DLANG_SPECIFIC_DRIVER added.
+# It'd be nice if we could find an easier way to do this---rather than have
+# to track changes to the toplevel gcc Makefile as well.
+# We depend on g++.c last, to make it obvious where it came from.
+g++.o: $(CONFIG_H) multilib.h config.status $(lang_specs_files) g++.c
+       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+       $(DRIVER_DEFINES) \
+       -DLANG_SPECIFIC_DRIVER \
+  -c g++.c
+
 # Create the compiler driver for g++.
-g++: $(srcdir)/cp/g++.c $(CONFIG_H) choose-temp.o pexecute.o $(LIBDEPS)
-       $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o $@ $(srcdir)/cp/g++.c choose-temp.o pexecute.o $(LIBS)
+g++$(exeext): g++.o g++spec.o version.o choose-temp.o pexecute.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
+       $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g++.o g++spec.o version.o \
+         choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
 
 # Create a version of the g++ driver which calls the cross-compiler.
-g++-cross: $(srcdir)/cp/g++.c choose-temp.o pexecute.o $(LIBDEPS)
-       $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o $@ \
-          -DGCC_NAME=\"$(GCC_CROSS_NAME)\" $(srcdir)/cp/g++.c choose-temp.o pexecute.o $(LIBS)
+g++-cross$(exeext): g++$(exeext)
+       -rm -f g++-cross$(exeext)
+       cp g++$(exeext) g++-cross$(exeext)
 
 cxxmain.o: cplus-dem.c demangle.h
        rm -f cxxmain.c
index d1adc3a..51192fb 100644 (file)
@@ -1281,7 +1281,7 @@ find_scoped_type (type, inner_name, inner_types)
       if (TREE_PURPOSE (tags) == inner_name)
        {
          if (inner_types == NULL_TREE)
-           return TYPE_NAME (TREE_VALUE (tags));
+           return TYPE_MAIN_DECL (TREE_VALUE (tags));
          return resolve_scope_to_name (TREE_VALUE (tags), inner_types);
        }
       tags = TREE_CHAIN (tags);
@@ -1326,7 +1326,7 @@ resolve_scope_to_name (outer_type, inner_stuff)
 
          if (rval != NULL_TREE)
            return rval;
-         type = DECL_CONTEXT (TYPE_NAME (type));
+         type = DECL_CONTEXT (TYPE_MAIN_DECL (type));
        }
     }
 
@@ -4240,6 +4240,7 @@ build_user_type_conversion_1 (totype, expr, flags)
       cand = candidates;       /* any one will do */
       cand->second_conv = build1 (AMBIG_CONV, totype, expr);
       ICS_USER_FLAG (cand->second_conv) = 1;
+      ICS_BAD_FLAG (cand->second_conv) = 1;
 
       return cand;
     }
@@ -4821,7 +4822,9 @@ static tree
 convert_like (convs, expr)
      tree convs, expr;
 {
-  if (ICS_BAD_FLAG (convs))
+  if (ICS_BAD_FLAG (convs)
+      && TREE_CODE (convs) != USER_CONV
+      && TREE_CODE (convs) != AMBIG_CONV)
     {
       tree t = convs; 
       for (; t; t = TREE_OPERAND (t, 0))
index 67498ee..8d766b6 100644 (file)
@@ -1793,8 +1793,7 @@ finish_struct_bits (t, max_has_virtual)
          && CLASSTYPE_NON_AGGREGATE (t)))
     {
       tree variants;
-      if (TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)
-       DECL_MODE (TYPE_NAME (t)) = BLKmode;
+      DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode;
       for (variants = t; variants; variants = TYPE_NEXT_VARIANT (variants))
        {
          TYPE_MODE (variants) = BLKmode;
@@ -1997,7 +1996,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
 
   if (nonprivate_method == 0
       && CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
-      && DECL_FRIENDLIST (TYPE_NAME (t)) == NULL_TREE)
+      && DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE)
     {
       tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
       for (i = 0; i < n_baseclasses; i++)
@@ -2022,7 +2021,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
        TYPE_HAS_DESTRUCTOR (t) = 0;
       else if (TREE_PRIVATE (dtor)
               && CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
-              && DECL_FRIENDLIST (TYPE_NAME (t)) == NULL_TREE
+              && DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE
               && warn_ctor_dtor_privacy)
        cp_warning ("`%#T' only defines a private destructor and has no friends",
                    t);
@@ -3644,7 +3643,7 @@ finish_struct_1 (t, warn_anon)
 
       if (TYPE_HAS_CONSTRUCTOR (t)
          && CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
-         && DECL_FRIENDLIST (TYPE_NAME (t)) == NULL_TREE)
+         && DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE)
        {
          int nonprivate_ctor = 0;
          tree ctor;
@@ -3748,6 +3747,7 @@ finish_struct_1 (t, warn_anon)
       DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE);
       CLASSTYPE_VFIELD (t) = vfield;
       DECL_VIRTUAL_P (vfield) = 1;
+      DECL_ARTIFICIAL (vfield) = 1;
       DECL_FIELD_CONTEXT (vfield) = t;
       DECL_CLASS_CONTEXT (vfield) = t;
       DECL_FCONTEXT (vfield) = t;
@@ -3861,8 +3861,7 @@ finish_struct_1 (t, warn_anon)
      value for DECL_OFFSET, so that we can use it as part
      of a COMPONENT_REF for multiple inheritance.  */
 
-  if (TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)
-    layout_decl (TYPE_NAME (t), 0);
+  layout_decl (TYPE_MAIN_DECL (t), 0);
 
   /* Now fix up any virtual base class types that we left lying
      around.  We must get these done before we try to lay out the
@@ -4174,9 +4173,9 @@ finish_struct_1 (t, warn_anon)
     {
       /* Be smarter about nested classes here.  If a type is nested,
         only output it if we would output the enclosing type.  */
-      if (DECL_CONTEXT (TYPE_NAME (t))
-         && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_NAME (t)))) == 't')
-       DECL_IGNORED_P (TYPE_NAME (t)) = TREE_ASM_WRITTEN (TYPE_NAME (t));
+      if (DECL_CONTEXT (TYPE_MAIN_DECL (t))
+         && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_MAIN_DECL (t)))) == 't')
+       DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));
     }
 #endif
 
@@ -4199,24 +4198,24 @@ finish_struct_1 (t, warn_anon)
          /* Don't output full info about any type
             which does not have its implementation defined here.  */
          if (TYPE_VIRTUAL_P (t) && write_virtuals == 2)
-           TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t))
+           TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t))
              = (value_member (TYPE_IDENTIFIER (t), pending_vtables) == 0);
          else if (CLASSTYPE_INTERFACE_ONLY (t))
-           TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 1;
+           TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
 #if 0
          /* XXX do something about this.  */
          else if (CLASSTYPE_INTERFACE_UNKNOWN (t))
            /* Only a first approximation!  */
-           TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 1;
+           TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
 #endif
        }
       else if (CLASSTYPE_INTERFACE_ONLY (t))
-       TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 1;
-
-      /* Finish debugging output for this type.  */
-      rest_of_type_compilation (t, toplevel_bindings_p ());
+       TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
     }
 
+  /* Finish debugging output for this type.  */
+  rest_of_type_compilation (t, toplevel_bindings_p ());
+
   return t;
 }
 
@@ -4355,7 +4354,7 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
       CLASSTYPE_TAGS (t) = x = nreverse (CLASSTYPE_TAGS (t));
       while (x)
        {
-         tree tag = TYPE_NAME (TREE_VALUE (x));
+         tree tag = TYPE_MAIN_DECL (TREE_VALUE (x));
 
          TREE_NONLOCAL_FLAG (TREE_VALUE (x)) = 0;
          x = TREE_CHAIN (x);
@@ -4747,7 +4746,7 @@ push_nested_class (type, modify)
       || TREE_CODE (type) == TEMPLATE_TYPE_PARM)
     return;
   
-  context = DECL_CONTEXT (TYPE_NAME (type));
+  context = DECL_CONTEXT (TYPE_MAIN_DECL (type));
 
   if (context && TREE_CODE (context) == RECORD_TYPE)
     push_nested_class (context, 2);
@@ -4760,7 +4759,7 @@ void
 pop_nested_class (modify)
      int modify;
 {
-  tree context = DECL_CONTEXT (TYPE_NAME (current_class_type));
+  tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
 
   popclass (modify);
   if (context && TREE_CODE (context) == RECORD_TYPE)
index 528f1b7..3ec8df6 100644 (file)
@@ -312,7 +312,7 @@ enum languages { lang_c, lang_cplusplus };
 #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
 
 /* The _DECL for this _TYPE.  */
-#define TYPE_MAIN_DECL(NODE) (TYPE_NAME (NODE))
+#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
 
 #define IS_AGGR_TYPE(t)                (TYPE_LANG_FLAG_5 (t))
 #define IS_AGGR_TYPE_CODE(t)   (t == RECORD_TYPE || t == UNION_TYPE)
@@ -2470,6 +2470,7 @@ extern tree convert_for_initialization            PROTO((tree, tree, tree, int, char *, tr
 extern void c_expand_asm_operands              PROTO((tree, tree, tree, tree, int, char *, int));
 extern void c_expand_return                    PROTO((tree));
 extern tree c_expand_start_case                        PROTO((tree));
+extern int ptr_reasonably_similar              PROTO((tree, tree));
 extern tree build_component_ref                        PROTO((tree, tree, tree, int));
 extern tree build_ptrmemfunc                   PROTO((tree, tree, int));
 
index 410a34b..aff7dee 100644 (file)
@@ -340,8 +340,9 @@ convert_to_pointer_force (type, expr)
          if (distance == -2)
            {
            ambig:
-             cp_error ("type `%T' is ambiguous baseclass of `%s'", TREE_TYPE (type),
-                                   TYPE_NAME_STRING (TREE_TYPE (intype)));
+             cp_error ("type `%T' is ambiguous baseclass of `%s'",
+                       TREE_TYPE (type),
+                       TYPE_NAME_STRING (TREE_TYPE (intype)));
              return error_mark_node;
            }
          if (distance == -1)
@@ -608,6 +609,10 @@ build_up_reference (type, arg, flags, checkconst)
       arg = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE, NULL_TREE);
     }
 
+  /* If we had a way to wrap this up, and say, if we ever needed it's
+     address, transform all occurrences of the register, into a memory
+     reference we could win better.  */
+  mark_addressable (arg);
   rval = build1 (ADDR_EXPR, type, arg);
 
  done:
index ebfc6b4..43a60d6 100644 (file)
@@ -99,9 +99,9 @@ static struct stack_level *decl_stack;
 
 #ifndef BOOL_TYPE_SIZE
 #ifdef SLOW_BYTE_ACCESS
-#define BOOL_TYPE_SIZE ((SLOW_BYTE_ACCESS) ? (BITS_PER_WORD) : (BITS_PER_UNIT))
+#define BOOL_TYPE_SIZE ((SLOW_BYTE_ACCESS) ? (POINTER_SIZE) : (CHAR_TYPE_SIZE))
 #else
-#define BOOL_TYPE_SIZE BITS_PER_UNIT
+#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
 #endif
 #endif
 
@@ -2070,7 +2070,7 @@ pushtag (name, type, globalize)
                  set_identifier_type_value_with_scope (name, type, b);
                }
              else
-               d = TYPE_NAME (d);
+               d = TYPE_MAIN_DECL (d);
 
              TYPE_NAME (type) = d;
              DECL_CONTEXT (d) = context;
@@ -2088,7 +2088,7 @@ pushtag (name, type, globalize)
              newdecl = 1;
              d = build_decl (TYPE_DECL, name, type);
              SET_DECL_ARTIFICIAL (d);
-             TYPE_MAIN_DECL (type) = d;
+             TYPE_NAME (type) = d;
              DECL_CONTEXT (d) = context;
              if (! globalize && processing_template_decl && IS_AGGR_TYPE (type))
                push_template_decl (d);
@@ -2097,11 +2097,8 @@ pushtag (name, type, globalize)
            }
          if (newdecl)
            {
-             if (write_symbols != DWARF_DEBUG && write_symbols != DWARF2_DEBUG)
-               {
-                 if (ANON_AGGRNAME_P (name))
-                   DECL_IGNORED_P (d) = 1;
-               }
+             if (ANON_AGGRNAME_P (name))
+               DECL_IGNORED_P (d) = 1;
 
              TYPE_CONTEXT (type) = DECL_CONTEXT (d);
              DECL_ASSEMBLER_NAME (d)
@@ -4103,7 +4100,7 @@ lookup_tag (form, name, binding_level, thislevel_only)
                    if (TYPE_SIZE (context) == NULL_TREE)
                      goto no_context;
                    /* Go to next enclosing type, if any.  */
-                   context = DECL_CONTEXT (TYPE_NAME (context));
+                   context = DECL_CONTEXT (TYPE_MAIN_DECL (context));
                    break;
                case 'd':
                    context = DECL_CONTEXT (context);
@@ -4156,34 +4153,6 @@ lookup_tag_reverse (type, name)
     }
   return NULL_TREE;
 }
-
-/* Given type TYPE which was not declared in C++ language context,
-   attempt to find a name by which it is referred.  */
-
-tree
-typedecl_for_tag (tag)
-     tree tag;
-{
-  struct binding_level *b = current_binding_level;
-
-  if (TREE_CODE (TYPE_NAME (tag)) == TYPE_DECL)
-    return TYPE_NAME (tag);
-
-  while (b)
-    {
-      tree decls = b->names;
-      while (decls)
-       {
-         if (TREE_CODE (decls) == TYPE_DECL && TREE_TYPE (decls) == tag)
-           break;
-         decls = TREE_CHAIN (decls);
-       }
-      if (decls)
-       return decls;
-      b = b->level_chain;
-    }
-  return NULL_TREE;
-}
 \f
 /* Lookup TYPE in CONTEXT (a chain of nested types or a FUNCTION_DECL).
    Return the type value, or NULL_TREE if not found.  */
@@ -4288,7 +4257,8 @@ make_typename_type (context, name)
     pop_obstacks ();
 
   TYPE_CONTEXT (t) = context;
-  TYPE_MAIN_DECL (TREE_TYPE (d)) = d;
+  TYPE_NAME (TREE_TYPE (d)) = d;
+  TYPE_STUB_DECL (TREE_TYPE (d)) = d;
   DECL_CONTEXT (d) = context;
   CLASSTYPE_GOT_SEMICOLON (t) = 1;
 
@@ -4473,7 +4443,7 @@ lookup_name_real (name, prefer_type, nonclass)
          || TREE_CODE (val) == TYPE_DECL || prefer_type <= 0)
        ;
       else if (IDENTIFIER_HAS_TYPE_VALUE (name))
-       val = TYPE_NAME (IDENTIFIER_TYPE_VALUE (name));
+       val = TYPE_MAIN_DECL (IDENTIFIER_TYPE_VALUE (name));
       else if (TREE_TYPE (val) == error_mark_node)
        val = error_mark_node;
     }
@@ -5588,7 +5558,7 @@ shadow_tag (declspecs)
       code = TREE_CODE (value);
       if (IS_AGGR_TYPE_CODE (code) || code == ENUMERAL_TYPE)
        {
-         my_friendly_assert (TYPE_NAME (value) != NULL_TREE, 261);
+         my_friendly_assert (TYPE_MAIN_DECL (value) != NULL_TREE, 261);
 
          if (IS_AGGR_TYPE (value) && CLASSTYPE_USE_TEMPLATE (value))
            {
@@ -5629,16 +5599,33 @@ shadow_tag (declspecs)
          || (TREE_CODE (TYPE_NAME (t)) == TYPE_DECL
              && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))))
     {
+      /* See also grok_x_components.  */
+
       tree fn;
+      tree *q;
+
+      /* Wipe out memory of synthesized methods */
+      TYPE_HAS_CONSTRUCTOR (t) = 0;
+      TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0;
+      TYPE_HAS_INIT_REF (t) = 0;
+      TYPE_HAS_CONST_INIT_REF (t) = 0;
+      TYPE_HAS_ASSIGN_REF (t) = 0;
+      TYPE_HAS_ASSIGNMENT (t) = 0;
+      TYPE_HAS_CONST_ASSIGN_REF (t) = 0;
+
+      q = &TYPE_METHODS (t);
+      while (*q)
+       {
+         if (DECL_ARTIFICIAL (*q))
+           *q = TREE_CHAIN (*q);
+         else
+           q = &TREE_CHAIN (*q);
+       }
 
       /* ANSI C++ June 5 1992 WP 9.5.3.  Anonymous unions may not have
         function members.  */
-      for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
-       if (! DECL_ARTIFICIAL (fn))
-         {
-           error ("an anonymous union cannot have function members");
-           break;
-         }
+      if (TYPE_METHODS (t))
+       error ("an anonymous union cannot have function members");
 
       if (TYPE_FIELDS (t))
        {
@@ -5805,12 +5792,6 @@ start_decl (declarator, declspecs, initialized)
          }
       }
 
-  /* Do this before the decl is actually defined so that the DWARF debug
-     info for the class reflects the declaration, rather than the
-     definition, of this decl.  */
-  if (TREE_CODE (decl) == VAR_DECL && context)
-    note_debug_info_needed (context);
-
   if (initialized)
     {
       if (! toplevel_bindings_p ()
@@ -6239,7 +6220,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
       /* If we have installed this as the canonical typedef for this
         type, and that type has not been defined yet, delay emitting
         the debug informaion for it, as we will emit it later.  */
-      if (TYPE_NAME (TREE_TYPE (decl)) == decl
+      if (TYPE_MAIN_DECL (TREE_TYPE (decl)) == decl
          && TYPE_SIZE (TREE_TYPE (decl)) == NULL_TREE)
        TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
 
@@ -6455,6 +6436,10 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
        /* Let debugger know it should output info for this type.  */
        note_debug_info_needed (ttype);
 
+      if (TREE_STATIC (decl) && DECL_CONTEXT (decl)
+         && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
+       note_debug_info_needed (DECL_CONTEXT (decl));
+
       if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
          && DECL_SIZE (decl) != NULL_TREE
          && ! TREE_CONSTANT (DECL_SIZE (decl)))
@@ -7124,15 +7109,7 @@ grokfndecl (ctype, type, declarator, virtualp, flags, quals,
     return decl;
 
   if (check && funcdef_flag)
-    {
-      /* Do this before the decl is actually defined so that the DWARF debug
-        info for the class reflects the declaration, rather than the
-        definition, of this decl.  */
-      if (ctype)
-       note_debug_info_needed (ctype);
-
-      DECL_INITIAL (decl) = error_mark_node;
-    }
+    DECL_INITIAL (decl) = error_mark_node;
 
   if (flags == NO_SPECIAL && ctype && constructor_name (cname) == declarator)
     {
@@ -7242,14 +7219,15 @@ grokfndecl (ctype, type, declarator, virtualp, flags, quals,
 }
 
 static tree
-grokvardecl (type, declarator, specbits, initialized, constp)
+grokvardecl (type, declarator, specbits_in, initialized, constp)
      tree type;
      tree declarator;
-     RID_BIT_TYPE specbits;
+     RID_BIT_TYPE *specbits_in;
      int initialized;
      int constp;
 {
   tree decl;
+  RID_BIT_TYPE specbits = *specbits_in;
 
   if (TREE_CODE (type) == OFFSET_TYPE)
     {
@@ -8965,6 +8943,18 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
       if (constp || volatilep)
        type = cp_build_type_variant (type, constp, volatilep);
 
+      if (decl_context == FIELD)
+       {
+         if (declarator == current_class_name)
+           cp_pedwarn ("ANSI C++ forbids nested type `%D' with same name as enclosing class",
+                       declarator);
+         decl = build_lang_decl (TYPE_DECL, declarator, type);
+         if (IS_SIGNATURE (current_class_type) && opaque_typedef)
+           SIGNATURE_HAS_OPAQUE_TYPEDECLS (current_class_type) = 1;
+       }
+      else
+       decl = build_decl (TYPE_DECL, declarator, type);
+
       /* If the user declares "struct {...} foo" then `foo' will have
         an anonymous name.  Fill that name in now.  Nothing can
         refer to it, so nothing needs know about the name change.
@@ -8976,31 +8966,15 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
        {
          /* replace the anonymous name with the real name everywhere.  */
          lookup_tag_reverse (type, declarator);
-         TYPE_IDENTIFIER (type) = declarator;
+         TYPE_NAME (type) = decl;
 
          if (TYPE_LANG_SPECIFIC (type))
            TYPE_WAS_ANONYMOUS (type) = 1;
 
-         {
-           tree d = TYPE_NAME (type), c = DECL_CONTEXT (d);
-
-           DECL_ASSEMBLER_NAME (d) = DECL_NAME (d);
-           DECL_ASSEMBLER_NAME (d)
-             = get_identifier (build_overload_name (type, 1, 1));
-         }
-       }
-
-      if (decl_context == FIELD)
-       {
-         if (declarator == current_class_name)
-           cp_pedwarn ("ANSI C++ forbids nested type `%D' with same name as enclosing class",
-                       declarator);
-         decl = build_lang_decl (TYPE_DECL, declarator, type);
-         if (IS_SIGNATURE (current_class_type) && opaque_typedef)
-           SIGNATURE_HAS_OPAQUE_TYPEDECLS (current_class_type) = 1;
+         DECL_ASSEMBLER_NAME (decl) = DECL_NAME (decl);
+         DECL_ASSEMBLER_NAME (decl)
+           = get_identifier (build_overload_name (type, 1, 1));
        }
-      else
-       decl = build_decl (TYPE_DECL, declarator, type);
 
       if (TREE_CODE (type) == OFFSET_TYPE || TREE_CODE (type) == METHOD_TYPE)
        {
@@ -9290,7 +9264,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
               instantiation made the field's type be incomplete.  */
            if (current_class_type
                && TYPE_NAME (current_class_type)
-               && IDENTIFIER_TEMPLATE (DECL_NAME (TYPE_NAME (current_class_type)))
+               && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type))
                && declspecs && TREE_VALUE (declspecs)
                && TREE_TYPE (TREE_VALUE (declspecs)) == type)
              cp_error ("  in instantiation of template `%T'",
@@ -9519,7 +9493,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
          }
 
        /* An uninitialized decl with `extern' is a reference.  */
-       decl = grokvardecl (type, declarator, specbits, initialized, constp);
+       decl = grokvardecl (type, declarator, &specbits, initialized, constp);
        bad_specifiers (decl, "variable", virtualp, quals != NULL_TREE,
                        inlinep, friendp, raises != NULL_TREE);
 
@@ -10719,8 +10693,7 @@ finish_enum (enumtype, values)
   }
 
   /* Finish debugging output for this type.  */
-  if (write_symbols != DWARF_DEBUG && write_symbols != DWARF2_DEBUG)
-    rest_of_type_compilation (enumtype, global_bindings_p ());
+  rest_of_type_compilation (enumtype, global_bindings_p ());
 
   return enumtype;
 }
@@ -10912,8 +10885,8 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
       if (! DECL_ARGUMENTS (decl1)
          && !DECL_STATIC_FUNCTION_P (decl1)
          && DECL_CONTEXT (decl1)
-         && DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl1)))
-         && IDENTIFIER_TEMPLATE (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl1)))))
+         && TYPE_IDENTIFIER (DECL_CONTEXT (decl1))
+         && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1))))
        {
          cp_error ("redeclaration of `%#D'", decl1);
          if (IDENTIFIER_CLASS_VALUE (DECL_NAME (decl1)))
@@ -10999,12 +10972,6 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
        }
     }
 
-  /* Do this before the decl is actually defined so that the DWARF debug
-     info for the class reflects the declaration, rather than the
-     definition, of this decl.  */
-  if (DECL_FUNCTION_MEMBER_P (decl1))
-    note_debug_info_needed (DECL_CLASS_CONTEXT (decl1));
-
   /* Warn if function was previously implicitly declared
      (but not if we warned then).  */
   if (! warn_implicit
@@ -11991,6 +11958,9 @@ finish_function (lineno, call_poplevel, nested)
          mark_inline_for_output (fndecl);
        }
 
+      if (ctype && TREE_ASM_WRITTEN (fndecl))
+       note_debug_info_needed (ctype);
+
       current_function_returns_null |= can_reach_end;
 
       /* Since we don't normally go through c_expand_return for constructors,
@@ -12034,13 +12004,14 @@ finish_function (lineno, call_poplevel, nested)
 
   if (DECL_SAVED_INSNS (fndecl) == NULL_RTX)
     {
+      tree t;
+
       /* Stop pointing to the local nodes about to be freed.  */
       /* But DECL_INITIAL must remain nonzero so we know this
         was an actual function definition.  */
       DECL_INITIAL (fndecl) = error_mark_node;
-      /* And we need the arguments for template instantiation.  */
-      if (! processing_template_decl)
-       DECL_ARGUMENTS (fndecl) = NULL_TREE;
+      for (t = DECL_ARGUMENTS (fndecl); t; t = TREE_CHAIN (t))
+       DECL_RTL (t) = NULL_RTX;
     }
 
   if (DECL_STATIC_CONSTRUCTOR (fndecl))
@@ -12411,7 +12382,11 @@ cplus_expand_expr_stmt (exp)
         libg++ to miscompile, and tString to core dump.  */
       exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp);
 #endif
-      expand_expr_stmt (break_out_cleanups (exp));
+      /* If we don't do this, we end up down inside expand_expr
+        trying to do TYPE_MODE on the ERROR_MARK, and really
+        go outside the bounds of the type.  */
+      if (exp != error_mark_node)
+       expand_expr_stmt (break_out_cleanups (exp));
     }
 
   /* Clean up any pending cleanups.  This happens when a function call
index a2d73c4..85b5876 100644 (file)
@@ -778,7 +778,10 @@ grok_x_components (specs, components)
          if (TREE_CODE (t) == UNION_TYPE
              && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
            {
+             /* See also shadow_tag.  */
+
              struct pending_inline **p;
+             tree *q;
              x = build_lang_field_decl (FIELD_DECL, NULL_TREE, t);
 
              /* Wipe out memory of synthesized methods */
@@ -790,6 +793,17 @@ grok_x_components (specs, components)
              TYPE_HAS_ASSIGNMENT (t) = 0;
              TYPE_HAS_CONST_ASSIGN_REF (t) = 0;
 
+             q = &TYPE_METHODS (t);
+             while (*q)
+               {
+                 if (DECL_ARTIFICIAL (*q))
+                   *q = TREE_CHAIN (*q);
+                 else
+                   q = &TREE_CHAIN (*q);
+               }
+             if (TYPE_METHODS (t))
+               error ("an anonymous union cannot have function members");
+
              p = &pending_inlines;
              for (; *p; *p = (*p)->next)
                if (DECL_CONTEXT ((*p)->fndecl) != t)
@@ -2163,6 +2177,7 @@ finish_builtin_type (type, name, fields, len, align_type)
 #else
   TYPE_NAME (type) = build_decl (TYPE_DECL, get_identifier (name), type);
 #endif
+  TYPE_STUB_DECL (type) = TYPE_NAME (type);
   layout_decl (TYPE_NAME (type), 0);
 }
 \f
@@ -2989,13 +3004,20 @@ finish_file ()
     {
       tree decl = TREE_VALUE (pending_statics);
 
-      if (TREE_USED (decl) == 1
-         || TREE_READONLY (decl) == 0
-         || DECL_INITIAL (decl) == 0)
-       {
-         DECL_DEFER_OUTPUT (decl) = 0;
-         rest_of_decl_compilation (decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), 1, 1);
-       }
+      /* Output DWARF debug information.  */
+#ifdef DWARF_DEBUGGING_INFO
+      if (write_symbols == DWARF_DEBUG)
+       dwarfout_file_scope_decl (decl, 1);
+#endif
+#ifdef DWARF2_DEBUGGING_INFO
+      if (write_symbols == DWARF2_DEBUG)
+       dwarf2out_decl (decl);
+#endif
+
+      DECL_DEFER_OUTPUT (decl) = 0;
+      rest_of_decl_compilation
+       (decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), 1, 1);
+
       pending_statics = TREE_CHAIN (pending_statics);
     }
 
index 5adab9d..47b821e 100644 (file)
@@ -1486,7 +1486,7 @@ cp_file_of (t)
   if (TREE_CODE (t) == PARM_DECL)
     return DECL_SOURCE_FILE (DECL_CONTEXT (t));
   else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
-    return DECL_SOURCE_FILE (TYPE_NAME (t));
+    return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
   else
     return DECL_SOURCE_FILE (t);
 }
@@ -1502,7 +1502,7 @@ cp_line_of (t)
     t = TREE_TYPE (t);
 
   if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
-    line = DECL_SOURCE_LINE (TYPE_NAME (t));
+    line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
   else
     line = DECL_SOURCE_LINE (t);
 
index 154ab80..006e13f 100644 (file)
@@ -2227,7 +2227,7 @@ is_friend (type, supplicant)
   if (declp)
     /* It's a function decl.  */
     {
-      tree list = DECL_FRIENDLIST (TYPE_NAME (type));
+      tree list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type));
       tree name = DECL_NAME (supplicant);
       tree ctype;
 
@@ -2259,7 +2259,7 @@ is_friend (type, supplicant)
       if (type == supplicant)
        return 1;
       
-      list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_NAME (type)));
+      list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_MAIN_DECL (type)));
       for (; list ; list = TREE_CHAIN (list))
        if (supplicant == TREE_VALUE (list))
          return 1;
@@ -2275,7 +2275,7 @@ is_friend (type, supplicant)
        if (IS_AGGR_TYPE (supplicant))
          context = NULL_TREE;
        else
-         context = DECL_CONTEXT (TYPE_NAME (supplicant));
+         context = DECL_CONTEXT (TYPE_MAIN_DECL (supplicant));
       }
     else if (DECL_FUNCTION_MEMBER_P (supplicant))
       context = DECL_CLASS_CONTEXT (supplicant);
@@ -2296,7 +2296,7 @@ static void
 add_friend (type, decl)
      tree type, decl;
 {
-  tree typedecl = TYPE_NAME (type);
+  tree typedecl = TYPE_MAIN_DECL (type);
   tree list = DECL_FRIENDLIST (typedecl);
   tree name = DECL_NAME (decl);
 
@@ -2346,7 +2346,7 @@ static void
 add_friends (type, name, friend_type)
      tree type, name, friend_type;
 {
-  tree typedecl = TYPE_NAME (type);
+  tree typedecl = TYPE_MAIN_DECL (type);
   tree list = DECL_FRIENDLIST (typedecl);
 
   while (list)
@@ -2409,7 +2409,7 @@ make_friend_class (type, friend_type)
   if (IS_SIGNATURE (friend_type))
     {
       error ("signature type `%s' declared `friend'",
-            IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (friend_type))));
+            IDENTIFIER_POINTER (TYPE_IDENTIFIER (friend_type)));
       return;
     }
   if (type == friend_type)
@@ -2561,7 +2561,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
          warning ("implicitly declaring `%s' as struct",
                   IDENTIFIER_POINTER (declarator));
          decl = xref_tag (record_type_node, declarator, NULL_TREE, 1);
-         decl = TYPE_NAME (decl);
+         decl = TYPE_MAIN_DECL (decl);
        }
 
       /* Allow abbreviated declarations of overloaded functions,
@@ -2735,7 +2735,7 @@ build_new (placement, decl, init, use_global_new)
        {
          /* An aggregate type.  */
          type = IDENTIFIER_TYPE_VALUE (decl);
-         decl = TYPE_NAME (type);
+         decl = TYPE_MAIN_DECL (type);
        }
       else
        {
@@ -2755,7 +2755,7 @@ build_new (placement, decl, init, use_global_new)
     {
       type = decl;
       true_type = type;
-      decl = TYPE_NAME (type);
+      decl = TYPE_MAIN_DECL (type);
     }
 
   if (processing_template_decl)
index 448cb1f..a34e4f0 100644 (file)
@@ -1112,7 +1112,7 @@ set_vardecl_interface_info (prev, vars)
   if (CLASSTYPE_INTERFACE_KNOWN (type))
     {
       if (CLASSTYPE_INTERFACE_ONLY (type))
-       set_typedecl_interface_info (prev, TYPE_NAME (type));
+       set_typedecl_interface_info (prev, TYPE_MAIN_DECL (type));
       else
        CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1;
       DECL_EXTERNAL (vars) = CLASSTYPE_INTERFACE_ONLY (type);
@@ -2721,8 +2721,8 @@ identifier_typedecl_value (node)
   do (IDENTIFIER_GLOBAL_VALUE (node));
 #undef do
   /* Will this one ever happen?  */
-  if (TYPE_NAME (type))
-    return TYPE_NAME (type);
+  if (TYPE_MAIN_DECL (type))
+    return TYPE_MAIN_DECL (type);
 
   /* We used to do an internal error of 62 here, but instead we will
      handle the return of a null appropriately in the callers.  */
@@ -3366,7 +3366,7 @@ real_yylex ()
                    ))
              {
                pedwarn ("floating point number exceeds range of `%s'",
-                        IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
+                        IDENTIFIER_POINTER (TYPE_IDENTIFIER (type)));
              }
            /* Note: garbage_chars is -1 if first char is *not* garbage.  */
            while (isalnum (c))
index c7e3a87..80198c6 100644 (file)
@@ -324,7 +324,7 @@ build_overload_nested_name (decl)
     {
       tree context = DECL_CONTEXT (decl);
       if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
-       context = TYPE_MAIN_DECL (context);
+       context = TYPE_NAME (context);
       build_overload_nested_name (context);
     }
 
@@ -903,10 +903,10 @@ build_overload_name (parmtypes, begin, end)
                if (i > 9)
                  OB_PUTC ('_');
                numeric_output_need_bar = 0;
-               build_overload_nested_name (TYPE_MAIN_DECL (parmtype));
+               build_overload_nested_name (TYPE_NAME (parmtype));
              }
            else              
-             build_overload_identifier (TYPE_MAIN_DECL (parmtype));
+             build_overload_identifier (TYPE_NAME (parmtype));
            break;
          }
 
@@ -1075,7 +1075,7 @@ build_typename_overload (type)
   id = get_identifier (obstack_base (&scratch_obstack));
   IDENTIFIER_OPNAME_P (id) = 1;
 #if 0
-  IDENTIFIER_GLOBAL_VALUE (id) = TYPE_NAME (type);
+  IDENTIFIER_GLOBAL_VALUE (id) = TYPE_MAIN_DECL (type);
 #endif
   TREE_TYPE (id) = type;
   return id;
index 2a75142..845bda2 100644 (file)
@@ -1208,7 +1208,8 @@ expr_no_commas:
                { $$ = build_x_conditional_expr ($$, $3, $5); }
        | expr_no_commas '=' expr_no_commas
                { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
-                  C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
+                 if ($$ != error_mark_node)
+                    C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
        | expr_no_commas ASSIGN expr_no_commas
                { $$ = build_x_modify_expr ($$, $2, $3); }
        | THROW
@@ -2233,10 +2234,7 @@ named_complex_class_head_sans_basetype:
                {
                  current_aggr = $1;
                  if (TREE_CODE ($3) == TYPE_DECL)
-                   {
-                     $$ = $3;
-                     note_debug_info_needed (DECL_CONTEXT ($$));
-                   }
+                   $$ = $3;
                  else
                    {
                      cp_error ("`%T' does not have a nested type named `%D'",
index 9c4f42f..1a7d20e 100644 (file)
@@ -149,7 +149,8 @@ process_template_parm (list, next)
       tree t = make_lang_type (TEMPLATE_TYPE_PARM);
       CLASSTYPE_GOT_SEMICOLON (t) = 1;
       decl = build_decl (TYPE_DECL, TREE_VALUE (parm), t);
-      TYPE_MAIN_DECL (t) = decl;
+      TYPE_NAME (t) = decl;
+      TYPE_STUB_DECL (t) = decl;
       parm = decl;
       TEMPLATE_TYPE_SET_INFO (t, idx, processing_template_decl);
     }
@@ -372,9 +373,13 @@ coerce_template_parms (parms, arglist, in_decl)
              else
                arg = TREE_VALUE (arg);
            }
-         else
+         else if (TREE_CODE (TREE_VALUE (TREE_VEC_ELT (parms, i)))
+                  == TYPE_DECL)
            arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
                          &TREE_VEC_ELT (vec, 0), i, in_decl);
+         else
+           arg = tsubst_expr (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
+                              &TREE_VEC_ELT (vec, 0), i, in_decl);
 
          TREE_VEC_ELT (vec, i) = arg;
        }
@@ -1679,6 +1684,9 @@ tsubst (t, args, nargs, in_decl)
       }
 
     case TYPE_DECL:
+      if (t == TYPE_NAME (TREE_TYPE (t)))
+       return TYPE_NAME (type);
+
       {
        tree r = copy_node (t);
        TREE_TYPE (r) = type;
index b503d78..25e68e9 100644 (file)
@@ -2542,17 +2542,6 @@ dfs_debug_mark (binfo)
   if (methods == 0)
     return;
 
-  /* We can't do the TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
-     does not support name references between translation units.  Well, we
-     could, but that would mean putting global labels in the debug output
-     before each exported type and each of its functions and static data
-     members.  */
-  if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
-    {
-      rest_of_type_compilation (t, global_bindings_p ());
-      return;
-    }
-
   /* If interface info is known, either we've already emitted the debug
      info or we don't need to.  */
   if (CLASSTYPE_INTERFACE_KNOWN (t)
@@ -3138,6 +3127,14 @@ note_debug_info_needed (type)
   if (current_template_parms)
     return;
 
+  /* We can't do the TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
+     does not support name references between translation units.  Well, we
+     could, but that would mean putting global labels in the debug output
+     before each exported type and each of its functions and static data
+     members.  */
+  if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
+    return;
+
   dfs_walk (TYPE_BINFO (type), dfs_debug_mark, dfs_debug_unmarkedp);
   for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
     {
@@ -3195,7 +3192,12 @@ envelope_add_decl (type, decl, values)
          else
            dont_add = 1;
        }
-      else if (context && TYPE_DERIVES_FROM (context, type))
+      /* If we don't check CLASSTYPE_CID on CONTEXT right now, we'll end
+        up subtracting from the address of MI_MATRIX, putting us off
+        in la la land.  */
+      else if (context
+              && CLASSTYPE_CID (context)
+              && TYPE_DERIVES_FROM (context, type))
        {
          /* Don't add in *values to list */
          *values = NULL_TREE;
@@ -3213,7 +3215,12 @@ envelope_add_decl (type, decl, values)
          ? DECL_CLASS_CONTEXT (value)
            : DECL_CONTEXT (value);
 
-       if (context && TYPE_DERIVES_FROM (context, type))
+       /* If we don't check CLASSTYPE_CID on CONTEXT right now, we'll end
+          up subtracting from the address of MI_MATRIX, putting us off
+          in la la land.  */
+       if (context
+           && CLASSTYPE_CID (context)
+           && TYPE_DERIVES_FROM (context, type))
          {
            /* remove *tmp from list */
            *tmp = TREE_CHAIN (*tmp);
index 0d0dc05..a5b7916 100644 (file)
@@ -817,6 +817,7 @@ layout_basetypes (rec, binfos)
             them too.  */
          DECL_ASSEMBLER_NAME (decl) = get_identifier (VTABLE_BASE);
          DECL_VIRTUAL_P (decl) = 1;
+         DECL_ARTIFICIAL (decl) = 1;
          DECL_FIELD_CONTEXT (decl) = rec;
          DECL_CLASS_CONTEXT (decl) = rec;
          DECL_FCONTEXT (decl) = basetype;
index 146cf07..fd083e1 100644 (file)
@@ -1805,10 +1805,13 @@ build_component_ref (datum, component, basetype_path, protect)
     }
   else
     {
+      tree name = component;
+      if (TREE_CODE (component) == VAR_DECL)
+       name = DECL_NAME (component);
       if (basetype_path == NULL_TREE)
        basetype_path = TYPE_BINFO (basetype);
-      field = lookup_field (basetype_path, component,
-                           protect && ! VFIELD_NAME_P (component), 0);
+      field = lookup_field (basetype_path, name,
+                           protect && !VFIELD_NAME_P (name), 0);
       if (field == error_mark_node)
        return error_mark_node;
 
@@ -1817,7 +1820,7 @@ build_component_ref (datum, component, basetype_path, protect)
          /* Not found as a data field, look for it as a method.  If found,
             then if this is the only possible one, return it, else
             report ambiguity error.  */
-         tree fndecls = lookup_fnfields (basetype_path, component, 1);
+         tree fndecls = lookup_fnfields (basetype_path, name, 1);
          if (fndecls == error_mark_node)
            return error_mark_node;
          if (fndecls)
@@ -1867,7 +1870,7 @@ build_component_ref (datum, component, basetype_path, protect)
                }
            }
 
-         cp_error ("`%#T' has no member named `%D'", basetype, component);
+         cp_error ("`%#T' has no member named `%D'", basetype, name);
          return error_mark_node;
        }
       else if (TREE_TYPE (field) == error_mark_node)
index 8c7604f..e6f765e 100644 (file)
@@ -1377,7 +1377,10 @@ build_m_component_ref (datum, component)
   else if (binfo == error_mark_node)
     return error_mark_node;
 
-  return build (OFFSET_REF, rettype, datum, component);
+  component = build (OFFSET_REF, rettype, datum, component);
+  if (TREE_CODE (type) == OFFSET_TYPE)
+    component = resolve_offset_ref (component);
+  return component;
 }
 
 /* Return a tree node for the expression TYPENAME '(' PARMS ')'.  */