]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
semantics.c (begin_class_definition): Update the struct's location here ...
authorNathan Sidwell <nathan@acm.org>
Thu, 3 Jun 1999 07:16:15 +0000 (07:16 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 3 Jun 1999 07:16:15 +0000 (07:16 +0000)
* semantics.c (begin_class_definition): Update the struct's
location here ...
* class.c (finish_struct): ... rather than here.
* decl.c (make_typename_type): Don't rely on uninitialized
variable.

From-SVN: r27326

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl.c
gcc/cp/semantics.c
gcc/testsuite/g++.old-deja/g++.pt/crash5.C
gcc/testsuite/g++.old-deja/g++.pt/t05.C
gcc/testsuite/g++.old-deja/g++.robertl/eb109.C

index d145518bdd19317d95b1565f1925f57210591e86..49ea8bc609eac9aa352514d2607d776e8076c8bf 100644 (file)
@@ -1,3 +1,12 @@
+1999-06-03  Nathan Sidwell  <nathan@acm.org>
+
+       * semantics.c (begin_class_definition): Update the struct's
+       location here ...
+       * class.c (finish_struct): ... rather than here.
+
+       * decl.c (make_typename_type): Don't rely on uninitialized
+       variable.
+
 1999-05-31  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Makefile.in (ALL_CFLAGS): Add '-W -Wall'.
index c6d6bcc84e8d827df48c41d48eb0a9f3c25e53eb..4fe5353edb6272816a12aa369775f987bafa92c6 100644 (file)
@@ -4173,23 +4173,6 @@ finish_struct (t, attributes, warn_anon)
      tree t, attributes;
      int warn_anon;
 {
-  tree name = TYPE_NAME (t);
-
-  if (TREE_CODE (name) == TYPE_DECL)
-    {
-      extern int lineno;
-         
-      DECL_SOURCE_FILE (name) = input_filename;
-      /* For TYPE_DECL that are not typedefs (those marked with a line
-        number of zero, we don't want to mark them as real typedefs.
-        If this fails one needs to make sure real typedefs have a
-        previous line number, even if it is wrong, that way the below
-        will fill in the right line number.  (mrs) */
-      if (DECL_SOURCE_LINE (name))
-       DECL_SOURCE_LINE (name) = lineno;
-      name = DECL_NAME (name);
-    }
-
   /* Append the fields we need for constructing signature tables.  */
   if (IS_SIGNATURE (t))
     append_signature_fields (t);
index c30fa7caf59bceb8a179ce7ab8fe097179e3b7cf..ac9933c819ae9858add858205cf228b5a3250b4a 100644 (file)
@@ -5516,7 +5516,6 @@ tree
 make_typename_type (context, name)
      tree context, name;
 {
-  tree t;
   tree fullname;
 
   if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
@@ -5576,14 +5575,15 @@ make_typename_type (context, name)
        }
       else
        {
-         if (IS_AGGR_TYPE (context))
-           t = lookup_field (context, name, 0, 1);
-         else
+          tree t;
+          
+         if (!IS_AGGR_TYPE (context))
            {
              cp_error ("no type named `%#T' in `%#T'", name, context);
              return error_mark_node;
            }
 
+         t = lookup_field (context, name, 0, 1);
          if (t)
            return TREE_TYPE (t);
        }
@@ -5591,7 +5591,7 @@ make_typename_type (context, name)
 
   /* If the CONTEXT is not a template type, then either the field is
      there now or its never going to be.  */
-  if (!uses_template_parms (context) && !t)
+  if (!uses_template_parms (context))
     {
       cp_error ("no type named `%#T' in `%#T'", name, context);
       return error_mark_node;
index 5be0ae1832678f87643d8edeba55cc88d243c104..37fb9da07d21ab075d6b83368eaac22d37359bfd 100644 (file)
@@ -1297,6 +1297,10 @@ begin_class_definition (t)
   else if (TYPE_SIZE (t))
     duplicate_tag_error (t);
 
+  /* Update the location of the decl.  */
+  DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
+  DECL_SOURCE_LINE (TYPE_NAME (t)) = lineno;
+  
   if (TYPE_BEING_DEFINED (t))
     {
       t = make_lang_type (TREE_CODE (t));
index 5797eee23e6235be708a3587687183b66bf395bb..99a7791628761266d2aeca45294c49960e390598 100644 (file)
@@ -1,9 +1,9 @@
 // Build don't link:
 
 template <class T, int i>
-struct K {
+struct K {  // ERROR - forward declaration
        void f();
-};  // ERROR - forward declaration
+};
 
 template <class T>
 void
index 5c99f772ad97dc1e03df473082a9f1ded8d68b25..6dab744b357ee66c6ade1e99ad81a66b8728cebc 100644 (file)
@@ -1,9 +1,9 @@
 // Build don't link: 
 
-template <class A> class B {   
+template <class A> class B {    // ERROR - candidates
   A a;                          
  public:
   B(A&aa);                     // ERROR - near match
   ~B();
-};  // ERROR - candidates
+};
 static B<int> b_int (3);       // ERROR - no matching function
index ccd206b0e2c4e6e1c20eb8b45bd63373170eab17..ff7bc5c6c7eb8052864cfb5387d20797a267dcd9 100644 (file)
@@ -17,7 +17,7 @@ inline istream& operator>>(istream& is, Empty& ) { return is;}
 
 template<class VertexType, class EdgeType>
 class Graph
-{ 
+{  // ERROR - candidates
   public:
     // public type interface
     typedef map<int, EdgeType > Successor;
@@ -32,7 +32,7 @@ class Graph
     bool directed;
     GraphType C;          // container
     ostream* pOut;
-}; // ERROR - candidates
+};
 
 // all graph-methods delet
 template<class VertexType, class EdgeType>