]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cp-tree.h (build_lang_field_decl): Remove.
authorMark Mitchell <mark@codesourcery.com>
Wed, 18 Aug 1999 20:44:14 +0000 (20:44 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 18 Aug 1999 20:44:14 +0000 (20:44 +0000)
        * cp-tree.h (build_lang_field_decl): Remove.
* class.c (build_vtable): Replace calls to build_lang_field_decl
with build_lang_decl.
(prepare_fresh_vtable): Likewise.
(finish_struct_1): Likewise.
(init_class_processing): Likewise.
* decl.c (push_using_decl): Likewise.
(init_decl_processsing): Likewise.
(grokvardecl): Likewise.
(build_ptrmemfunc_type): Likewise.
(grokdeclarator): Likewise.
(build_enumerator): Likewise.
* decl2.c (grok_x_components): Likewise.
(do_class_using_decl): Likewise.
* except.c (call_eh_info): Likewise.
* init.c (init_init_processing): Likewise.
* rtti.c (expand_class_decl): Likewise.
* tree.c (build_base_fields): Likewise.
(build_vbase_pointer_fields): Likewise.
* lex.c (build_lang_decl): Build declarations on the permanent
obstack if we're building statmeent trees.
(retrofit_lang_decl): Handle both the full lang_decl and also the
smaller lang_decl_flags here.
(build_lang_field_decl): Remove.
* pt.c (push_template_decl_real): Issue errors for variable
declarations that are not static members.

From-SVN: r28755

13 files changed:
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/except.c
gcc/cp/init.c
gcc/cp/lex.c
gcc/cp/pt.c
gcc/cp/rtti.c
gcc/cp/tree.c
gcc/testsuite/g++.old-deja/g++.pt/crash45.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/var1.C [new file with mode: 0644]

index 71d7839dfd4b47dfdfc8ab6efd98904b564fa424..0e1012f817176dac36f04e8452155ea04bf3b20b 100644 (file)
@@ -1,3 +1,32 @@
+1999-08-18  Mark Mitchell  <mark@codesourcery.com>
+
+        * cp-tree.h (build_lang_field_decl): Remove.
+       * class.c (build_vtable): Replace calls to build_lang_field_decl
+       with build_lang_decl.
+       (prepare_fresh_vtable): Likewise.
+       (finish_struct_1): Likewise.
+       (init_class_processing): Likewise.
+       * decl.c (push_using_decl): Likewise.
+       (init_decl_processsing): Likewise.
+       (grokvardecl): Likewise.
+       (build_ptrmemfunc_type): Likewise.
+       (grokdeclarator): Likewise.
+       (build_enumerator): Likewise.
+       * decl2.c (grok_x_components): Likewise.
+       (do_class_using_decl): Likewise.
+       * except.c (call_eh_info): Likewise.
+       * init.c (init_init_processing): Likewise.
+       * rtti.c (expand_class_decl): Likewise.
+       * tree.c (build_base_fields): Likewise.
+       (build_vbase_pointer_fields): Likewise.
+       * lex.c (build_lang_decl): Build declarations on the permanent
+       obstack if we're building statmeent trees.
+       (retrofit_lang_decl): Handle both the full lang_decl and also the
+       smaller lang_decl_flags here.
+       (build_lang_field_decl): Remove.
+       * pt.c (push_template_decl_real): Issue errors for variable
+       declarations that are not static members.
+
 1999-08-18  Richard Henderson  <rth@cygnus.com>
 
        * tree.c (search_tree): Handle TRUTH_{AND,OR,XOR}_EXPR too.
index 45374e9ae2113a38a7be65cc88184c69df99c210..a6499551f852fab5fffe3a6f87c84b68e9e4b74a 100644 (file)
@@ -737,8 +737,8 @@ build_vtable (binfo, type)
       tree offset;
 
       virtuals = copy_list (BINFO_VIRTUALS (binfo));
-      decl = build_lang_field_decl (VAR_DECL, name, 
-                                   TREE_TYPE (BINFO_VTABLE (binfo)));
+      decl = build_lang_decl (VAR_DECL, name, 
+                             TREE_TYPE (BINFO_VTABLE (binfo)));
 
       /* Now do rtti stuff.  */
       offset = get_derived_offset (TYPE_BINFO (type), NULL_TREE);
@@ -748,7 +748,7 @@ build_vtable (binfo, type)
   else
     {
       virtuals = NULL_TREE;
-      decl = build_lang_field_decl (VAR_DECL, name, void_type_node);
+      decl = build_lang_decl (VAR_DECL, name, void_type_node);
     }
 
 #ifdef GATHER_STATISTICS
@@ -898,7 +898,7 @@ prepare_fresh_vtable (binfo, for_type)
       buf2 = new_buf2;
     }
 
-  new_decl = build_lang_field_decl (VAR_DECL, name, TREE_TYPE (orig_decl));
+  new_decl = build_lang_decl (VAR_DECL, name, TREE_TYPE (orig_decl));
   /* Remember which class this vtable is really for.  */
   DECL_CONTEXT (new_decl) = for_type;
 
@@ -3841,7 +3841,7 @@ finish_struct_1 (t)
         bounds.  That's better than using `void*' or some such; it's
         cleaner, and it let's the alias analysis code know that these
         stores cannot alias stores to void*!  */
-      vfield = build_lang_field_decl (FIELD_DECL, get_vfield_name (t),
+      vfield = build_lang_decl (FIELD_DECL, get_vfield_name (t),
                                      vtbl_ptr_type_node);
       /* If you change any of the below, take a look at all the
         other VFIELD_BASEs and VTABLE_BASEs in the code, and change
@@ -3908,7 +3908,7 @@ finish_struct_1 (t)
   if (empty)
     {
       /* C++: do not let empty structures exist.  */
-      tree decl = build_lang_field_decl
+      tree decl = build_lang_decl
        (FIELD_DECL, NULL_TREE, char_type_node);
       TREE_CHAIN (decl) = fields;
       TYPE_FIELDS (t) = decl;
@@ -4507,7 +4507,7 @@ init_class_processing ()
   access_private_virtual_node = build_int_2 (7, 0);
 
   /* Keep these values lying around.  */
-  base_layout_decl = build_lang_field_decl (FIELD_DECL, NULL_TREE, error_mark_node);
+  base_layout_decl = build_lang_decl (FIELD_DECL, NULL_TREE, error_mark_node);
   TREE_TYPE (base_layout_decl) = make_node (RECORD_TYPE);
 
   gcc_obstack_init (&class_obstack);
index 6c585d4252a0ec00b3edd994f2ebbd3c8585dd52..905a6595e4561b2322ab240bd20cca7b6b55d5b6 100644 (file)
@@ -3159,7 +3159,6 @@ extern int real_yylex                             PROTO((void));
 extern int is_rid                              PROTO((tree));
 extern tree build_lang_decl                    PROTO((enum tree_code, tree, tree));
 extern void retrofit_lang_decl                 PROTO((tree));
-extern tree build_lang_field_decl              PROTO((enum tree_code, tree, tree));
 extern void copy_lang_decl                     PROTO((tree));
 extern tree make_lang_type                     PROTO((enum tree_code));
 extern void dump_time_statistics               PROTO((void));
index baf1a32cbf59d1002d7b0e6858feccbfe519bfb5..1b1ad983b452a44dd351ef96b08094a49f66e529 100644 (file)
@@ -4492,7 +4492,7 @@ push_using_decl (scope, name)
       break;
   if (decl)
     return NULL_TREE;
-  decl = build_lang_field_decl (USING_DECL, name, void_type_node);
+  decl = build_lang_decl (USING_DECL, name, void_type_node);
   DECL_INITIAL (decl) = scope;
   TREE_CHAIN (decl) = current_binding_level->usings;
   current_binding_level->usings = decl;
@@ -6511,12 +6511,12 @@ init_decl_processing ()
   else
     {
       vtable_entry_type = make_lang_type (RECORD_TYPE);
-      fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier,
-                                        delta_type_node);
-      fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier,
-                                        delta_type_node);
-      fields[2] = build_lang_field_decl (FIELD_DECL, pfn_identifier,
-                                        ptr_type_node);
+      fields[0] = build_lang_decl (FIELD_DECL, delta_identifier,
+                                  delta_type_node);
+      fields[1] = build_lang_decl (FIELD_DECL, index_identifier,
+                                  delta_type_node);
+      fields[2] = build_lang_decl (FIELD_DECL, pfn_identifier,
+                                  ptr_type_node);
       finish_builtin_type (vtable_entry_type, VTBL_PTR_TYPE, fields, 2,
                           double_type_node);
 
@@ -8624,7 +8624,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
         can be initialized, the code will reach here.  */
       tree basetype = TYPE_OFFSET_BASETYPE (type);
       type = TREE_TYPE (type);
-      decl = build_lang_field_decl (VAR_DECL, declarator, type);
+      decl = build_lang_decl (VAR_DECL, declarator, type);
       DECL_CONTEXT (decl) = basetype;
       DECL_CLASS_CONTEXT (decl) = basetype;
       DECL_ASSEMBLER_NAME (decl) = build_static_name (basetype, declarator);
@@ -8645,7 +8645,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
          /* If we're in a template, we need DECL_LANG_SPECIFIC so that
             we can call push_template_decl.  */
          push_permanent_obstack ();
-         decl = build_lang_field_decl (VAR_DECL, declarator,
+         decl = build_lang_decl (VAR_DECL, declarator,
                                        complete_type (type));
          pop_obstacks ();
        }
@@ -8742,9 +8742,9 @@ build_ptrmemfunc_type (type)
 
   u = make_lang_type (UNION_TYPE);
   SET_IS_AGGR_TYPE (u, 0);
-  fields[0] = build_lang_field_decl (FIELD_DECL, pfn_identifier, type);
-  fields[1] = build_lang_field_decl (FIELD_DECL, delta2_identifier,
-                                    delta_type_node);
+  fields[0] = build_lang_decl (FIELD_DECL, pfn_identifier, type);
+  fields[1] = build_lang_decl (FIELD_DECL, delta2_identifier,
+                              delta_type_node);
   finish_builtin_type (u, "__ptrmemfunc_type", fields, 1, ptr_type_node);
   TYPE_NAME (u) = NULL_TREE;
 
@@ -8755,11 +8755,11 @@ build_ptrmemfunc_type (type)
   /* ... and not really an aggregate.  */
   SET_IS_AGGR_TYPE (t, 0);
 
-  fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier,
-                                    delta_type_node);
-  fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier,
-                                    delta_type_node);
-  fields[2] = build_lang_field_decl (FIELD_DECL, pfn_or_delta2_identifier, u);
+  fields[0] = build_lang_decl (FIELD_DECL, delta_identifier,
+                              delta_type_node);
+  fields[1] = build_lang_decl (FIELD_DECL, index_identifier,
+                              delta_type_node);
+  fields[2] = build_lang_decl (FIELD_DECL, pfn_or_delta2_identifier, u);
   finish_builtin_type (t, "__ptrmemfunc_type", fields, 2, ptr_type_node);
 
   pop_obstacks ();
@@ -11044,16 +11044,16 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
              {
                /* C++ allows static class members.
                   All other work for this is done by grokfield.
-                  This VAR_DECL is built by build_lang_field_decl.
+                  This VAR_DECL is built by build_lang_decl.
                   All other VAR_DECLs are built by build_decl.  */
-               decl = build_lang_field_decl (VAR_DECL, declarator, type);
+               decl = build_lang_decl (VAR_DECL, declarator, type);
                TREE_STATIC (decl) = 1;
                /* In class context, 'static' means public access.  */
                TREE_PUBLIC (decl) = DECL_EXTERNAL (decl) = 1;
              }
            else
              {
-               decl = build_lang_field_decl (FIELD_DECL, declarator, type);
+               decl = build_lang_decl (FIELD_DECL, declarator, type);
                if (RIDBIT_SETP (RID_MUTABLE, specbits))
                  {
                    DECL_MUTABLE_P (decl) = 1;
@@ -12701,7 +12701,7 @@ build_enumerator (name, value, type)
  context = current_scope ();
  if (context && context == current_class_type)
    /* This enum declaration is local to the class.  */
-   decl = build_lang_field_decl (CONST_DECL, name, type);
+   decl = build_lang_decl (CONST_DECL, name, type);
  else
    /* It's a global enum, or it's local to a function.  (Note local to
       a function could mean local to a class method.  */
index 7fd9be0be6a2a00f5072bb0366ec5c50d1a3831d..a0a7e6c367fada6f5d7a8310f5d0bca3e44b6c20 100644 (file)
@@ -901,9 +901,7 @@ grok_x_components (specs)
     return;
 
   fixup_anonymous_aggr (t);
-  finish_member_declaration (build_lang_field_decl (FIELD_DECL,
-                                                   NULL_TREE,
-                                                   t)); 
+  finish_member_declaration (build_lang_decl (FIELD_DECL, NULL_TREE, t)); 
 
   /* Ignore any inline function definitions in the anonymous union
      since an anonymous union may not have function members.  */
@@ -5130,7 +5128,7 @@ do_class_using_decl (decl)
 
   my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716);
 
-  value = build_lang_field_decl (USING_DECL, name, void_type_node);
+  value = build_lang_decl (USING_DECL, name, void_type_node);
   DECL_INITIAL (value) = TREE_OPERAND (decl, 0);
   return value;
 }
index 2dbdbd3b91f6df418ad218b61744a13d206fae26..0a9bcf54f0fec253d33c1dd0c91003bae03b1715 100644 (file)
@@ -245,13 +245,13 @@ call_eh_info ()
       /* struct cp_eh_info.  This must match exception.cc.  Note that this
         type is not pushed anywhere.  */
       t1= make_lang_type (RECORD_TYPE);
-      fields[0] = build_lang_field_decl (FIELD_DECL, 
+      fields[0] = build_lang_decl (FIELD_DECL, 
                     get_identifier ("handler_label"), ptr_type_node);
-      fields[1] = build_lang_field_decl (FIELD_DECL, 
+      fields[1] = build_lang_decl (FIELD_DECL, 
                     get_identifier ("dynamic_handler_chain"), ptr_type_node);
-      fields[2] = build_lang_field_decl (FIELD_DECL, 
+      fields[2] = build_lang_decl (FIELD_DECL, 
                     get_identifier ("info"), ptr_type_node);
-      fields[3] = build_lang_field_decl (FIELD_DECL, 
+      fields[3] = build_lang_decl (FIELD_DECL, 
                     get_identifier ("table_index"), ptr_type_node);
       /* N.B.: The fourth field LEN is expected to be
         the number of fields - 1, not the total number of fields.  */
@@ -259,32 +259,32 @@ call_eh_info ()
       t1 = build_pointer_type (t1);
 
       t1= make_lang_type (RECORD_TYPE);
-      fields[0] = build_lang_field_decl (FIELD_DECL, 
+      fields[0] = build_lang_decl (FIELD_DECL, 
                     get_identifier ("match_function"), ptr_type_node);
-      fields[1] = build_lang_field_decl (FIELD_DECL, 
+      fields[1] = build_lang_decl (FIELD_DECL, 
                     get_identifier ("language"), short_integer_type_node);
-      fields[2] = build_lang_field_decl (FIELD_DECL, 
+      fields[2] = build_lang_decl (FIELD_DECL, 
                     get_identifier ("version"), short_integer_type_node);
       /* N.B.: The fourth field LEN is expected to be
         the number of fields - 1, not the total number of fields.  */
       finish_builtin_type (t1, "__eh_info", fields, 2, ptr_type_node);
       t = make_lang_type (RECORD_TYPE);
-      fields[0] = build_lang_field_decl (FIELD_DECL, 
-                                              get_identifier ("eh_info"), t1);
-      fields[1] = build_lang_field_decl (FIELD_DECL, get_identifier ("value"),
-                                        ptr_type_node);
-      fields[2] = build_lang_field_decl (FIELD_DECL, get_identifier ("type"),
-                                        ptr_type_node);
-      fields[3] = build_lang_field_decl
+      fields[0] = build_lang_decl (FIELD_DECL, 
+                                  get_identifier ("eh_info"), t1);
+      fields[1] = build_lang_decl (FIELD_DECL, get_identifier ("value"),
+                                  ptr_type_node);
+      fields[2] = build_lang_decl (FIELD_DECL, get_identifier ("type"),
+                                  ptr_type_node);
+      fields[3] = build_lang_decl
        (FIELD_DECL, get_identifier ("cleanup"),
         build_pointer_type (build_function_type
                             (ptr_type_node, tree_cons
                              (NULL_TREE, ptr_type_node, void_list_node))));
-      fields[4] = build_lang_field_decl (FIELD_DECL, get_identifier ("caught"),
-                                        boolean_type_node);
-      fields[5] = build_lang_field_decl (FIELD_DECL, get_identifier ("next"),
-                                        build_pointer_type (t));
-      fields[6] = build_lang_field_decl
+      fields[4] = build_lang_decl (FIELD_DECL, get_identifier ("caught"),
+                                  boolean_type_node);
+      fields[5] = build_lang_decl (FIELD_DECL, get_identifier ("next"),
+                                  build_pointer_type (t));
+      fields[6] = build_lang_decl
        (FIELD_DECL, get_identifier ("handlers"), long_integer_type_node);
       /* N.B.: The fourth field LEN is expected to be
         the number of fields - 1, not the total number of fields.  */
index 69758a62a459d293f0d8ae5ae7bea9d5b313cb35..f8c1980d214a612f77d78d3c2e74507345b7923c 100644 (file)
@@ -82,7 +82,7 @@ void init_init_processing ()
      arrays allocated via operator new.  */
   BI_header_type = make_lang_type (RECORD_TYPE);
   nc_nelts_field_id = get_identifier ("nelts");
-  fields[0] = build_lang_field_decl (FIELD_DECL, nc_nelts_field_id, sizetype);
+  fields[0] = build_lang_decl (FIELD_DECL, nc_nelts_field_id, sizetype);
   finish_builtin_type (BI_header_type, "__new_cookie", fields,
                       0, double_type_node);
   BI_header_size = size_in_bytes (BI_header_type);
index acff58fed3719fc51607e21d9b691d8e92abcde0..a67b37d97cc1ceed73761ae89f121cfcd587f83f 100644 (file)
@@ -4734,8 +4734,19 @@ build_lang_decl (code, name, type)
      tree name;
      tree type;
 {
-  register tree t = build_decl (code, name, type);
+  tree t;
+
+  /* When we're building statement trees, declarations need to live
+     forever.  */
+  if (building_stmt_tree ())
+    push_permanent_obstack ();
+
+  t = build_decl (code, name, type);
   retrofit_lang_decl (t);
+
+  if (building_stmt_tree ())
+    pop_obstacks ();
+
   return t;
 }
 
@@ -4748,8 +4759,12 @@ retrofit_lang_decl (t)
 {
   struct obstack *obstack = current_obstack;
   struct lang_decl *ld;
+  size_t size;
 
-  my_friendly_assert (CAN_HAVE_FULL_LANG_DECL_P (t), 19990816);
+  if (CAN_HAVE_FULL_LANG_DECL_P (t))
+    size = sizeof (struct lang_decl);
+  else
+    size = sizeof (struct lang_decl_flags);
 
   if (! TREE_PERMANENT (t))
     obstack = saveable_obstack;
@@ -4757,21 +4772,20 @@ retrofit_lang_decl (t)
     /* Could be that saveable is permanent and current is not.  */
     obstack = &permanent_obstack;
 
-  if (free_lang_decl_chain && obstack == &permanent_obstack)
+  if (CAN_HAVE_FULL_LANG_DECL_P (t) && free_lang_decl_chain 
+      && obstack == &permanent_obstack)
     {
       ld = free_lang_decl_chain;
       free_lang_decl_chain = free_lang_decl_chain->u.next;
     }
   else
-    ld = ((struct lang_decl *) 
-         obstack_alloc (obstack, sizeof (struct lang_decl)));
+    ld = (struct lang_decl *) obstack_alloc (obstack, size);
 
-  bzero (ld, sizeof (struct lang_decl));
+  bzero (ld, size);
 
   DECL_LANG_SPECIFIC (t) = ld;
   LANG_DECL_PERMANENT (ld) = obstack == &permanent_obstack;
   my_friendly_assert (LANG_DECL_PERMANENT (ld) == TREE_PERMANENT  (t), 234);
-  DECL_MAIN_VARIANT (t) = t;
   if (current_lang_name == lang_name_cplusplus)
     DECL_LANGUAGE (t) = lang_cplusplus;
   else if (current_lang_name == lang_name_c)
@@ -4780,39 +4794,15 @@ retrofit_lang_decl (t)
     DECL_LANGUAGE (t) = lang_java;
   else my_friendly_abort (64);
 
+  if (CAN_HAVE_FULL_LANG_DECL_P (t))
+    DECL_MAIN_VARIANT (t) = t;
+
 #ifdef GATHER_STATISTICS
   tree_node_counts[(int)lang_decl] += 1;
-  tree_node_sizes[(int)lang_decl] += sizeof (struct lang_decl);
+  tree_node_sizes[(int)lang_decl] += size;
 #endif
 }
 
-/* Like build_decl, except that a new lang_decl_flags structure is
-   placed in DECL_LANG_SPECIFIC.  */
-
-tree
-build_lang_field_decl (code, name, type)
-     enum tree_code code;
-     tree name;
-     tree type;
-{
-  extern struct obstack *current_obstack, *saveable_obstack;
-  register tree t = build_decl (code, name, type);
-  struct obstack *obstack = current_obstack;
-
-  if (! TREE_PERMANENT (t))
-    obstack = saveable_obstack;
-  else
-    my_friendly_assert (obstack == &permanent_obstack, 235);
-
-  my_friendly_assert (!CAN_HAVE_FULL_LANG_DECL_P (t), 19990816);
-
-  DECL_LANG_SPECIFIC (t) 
-    = ((struct lang_decl *) 
-       obstack_alloc (obstack, sizeof (struct lang_decl_flags)));
-  bzero (DECL_LANG_SPECIFIC (t), sizeof (struct lang_decl_flags));
-  return t;
-}
-
 void
 copy_lang_decl (node)
      tree node;
index 924f03fad59e9be94fce683e3acb6bcc3530789e..9a31d60699ddb701475e0f8b4208927b47bb959a 100644 (file)
@@ -2421,11 +2421,15 @@ push_template_decl_real (decl, is_friend)
     {
       if (current_lang_name == lang_name_c)
        cp_error ("template with C linkage");
-      if (TREE_CODE (decl) == TYPE_DECL && ANON_AGGRNAME_P (DECL_NAME (decl)))
+      else if (TREE_CODE (decl) == TYPE_DECL 
+              && ANON_AGGRNAME_P (DECL_NAME (decl))) 
        cp_error ("template class without a name");
-      if (TREE_CODE (decl) == TYPE_DECL 
+      else if (TREE_CODE (decl) == TYPE_DECL 
          && TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
        cp_error ("template declaration of `%#T'", TREE_TYPE (decl));
+      else if (TREE_CODE (decl) == VAR_DECL
+              && !CLASS_TYPE_P (CP_DECL_CONTEXT (decl)))
+       cp_error ("template declaration of `%#D'", decl);
     }
 
   /* Check to see that the rules regarding the use of default
index 3c65f38989e9051de177b228eca707efd5f634e6..93947d288c1d84dd71066eff9952c5c3518c0abc 100644 (file)
@@ -802,23 +802,23 @@ expand_class_desc (tdecl, type)
       base_info_type_node = make_lang_type (RECORD_TYPE);
 
       /* Actually const __user_type_info * */
-      fields [0] = build_lang_field_decl
+      fields [0] = build_lang_decl
        (FIELD_DECL, NULL_TREE,
         build_pointer_type (build_qualified_type
                             (type_info_type_node,
                              TYPE_QUAL_CONST)));
-      fields [1] = build_lang_field_decl
+      fields [1] = build_lang_decl
        (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
       DECL_BIT_FIELD (fields[1]) = 1;
       DECL_FIELD_SIZE (fields[1]) = 29;
 
-      fields [2] = build_lang_field_decl
+      fields [2] = build_lang_decl
        (FIELD_DECL, NULL_TREE, boolean_type_node);
       DECL_BIT_FIELD (fields[2]) = 1;
       DECL_FIELD_SIZE (fields[2]) = 1;
 
       /* Actually enum access */
-      fields [3] = build_lang_field_decl
+      fields [3] = build_lang_decl
        (FIELD_DECL, NULL_TREE, integer_type_node);
       DECL_BIT_FIELD (fields[3]) = 1;
       DECL_FIELD_SIZE (fields[3]) = 2;
index d493b1ec6086364983410be82ecd2d8ec0560851..d159ac143b37a894b2c6d59db40850ffdde56bea 100644 (file)
@@ -888,7 +888,7 @@ build_base_fields (rec)
       if (TREE_VIA_VIRTUAL (base_binfo))
        continue;
 
-      decl = build_lang_field_decl (FIELD_DECL, NULL_TREE, basetype);
+      decl = build_lang_decl (FIELD_DECL, NULL_TREE, basetype);
       DECL_ARTIFICIAL (decl) = 1;
       DECL_FIELD_CONTEXT (decl) = DECL_CLASS_CONTEXT (decl) = rec;
       DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
@@ -1000,8 +1000,8 @@ build_vbase_pointer_fields (rec)
                goto got_it;
            }
          FORMAT_VBASE_NAME (name, basetype);
-         decl = build_lang_field_decl (FIELD_DECL, get_identifier (name),
-                                       build_pointer_type (basetype));
+         decl = build_lang_decl (FIELD_DECL, get_identifier (name),
+                                 build_pointer_type (basetype));
          /* If you change any of the below, take a look at all the
             other VFIELD_BASEs and VTABLE_BASEs in the code, and change
             them too.  */
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash45.C b/gcc/testsuite/g++.old-deja/g++.pt/crash45.C
new file mode 100644 (file)
index 0000000..6201a5c
--- /dev/null
@@ -0,0 +1,13 @@
+// Build don't link:
+// Origin: Jason Merrill <jason@cygnus.com>
+
+template <class T> void f()
+{
+  extern void g ();
+}
+
+int main()
+{
+  f<int>();
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/var1.C b/gcc/testsuite/g++.old-deja/g++.pt/var1.C
new file mode 100644 (file)
index 0000000..06cbfa9
--- /dev/null
@@ -0,0 +1,4 @@
+// Build don't link:
+// Origin: Jason Merrill <jason@cygnus.com>
+
+template <class T> T t; // ERROR - template declaration of t