decl.c (bad_specifiers): It's OK to have an EH spec on a function pointer.
authorJason Merrill <jason@yorick.cygnus.com>
Sat, 7 Aug 1999 01:22:26 +0000 (01:22 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 7 Aug 1999 01:22:26 +0000 (21:22 -0400)
* decl.c (bad_specifiers): It's OK to have an EH spec on a function
pointer.

* pt.c (maybe_get_template_decl_from_type_decl): Make sure that
we're looking at a class.

From-SVN: r28562

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/pt.c
gcc/cp/typeck.c

index a9e045bc6ea4426f5411b3230984f8deb0b8a882..2840d96215599ed245ce243f107ae8b49ac6400f 100644 (file)
@@ -1,5 +1,11 @@
 1999-08-06  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * decl.c (bad_specifiers): It's OK to have an EH spec on a function
+       pointer.
+
+       * pt.c (maybe_get_template_decl_from_type_decl): Make sure that
+       we're looking at a class.
+
        * decl.c (lookup_name_real): Set the complain flag if we're
        looking for a namespace member.
 
index 038b09946159aabb3f2b2442d7b54a9768df325a..b3f534bb06ff138e1220314064d86c08147f90b8 100644 (file)
@@ -8362,9 +8362,9 @@ bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
     cp_error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration",
              object, type);
   if (friendp)
-    cp_error_at ("invalid friend declaration", object);
-  if (raises)
-    cp_error_at ("invalid exception specifications", object);
+    cp_error_at ("`%D' declared as a friend", object);
+  if (raises && ! TYPE_PTRFN_P (TREE_TYPE (object)))
+    cp_error_at ("`%D' declared with an exception specification", object);
 }
 
 /* CTYPE is class type, or null if non-class.
index 357b1d1694d0b77fed8b75b7540f3103d3c5890c..bab76341663c5cc09826e859a3abe9451c8a4d2a 100644 (file)
@@ -3616,6 +3616,7 @@ maybe_get_template_decl_from_type_decl (decl)
   return (decl != NULL_TREE
          && TREE_CODE (decl) == TYPE_DECL 
          && DECL_ARTIFICIAL (decl)
+         && CLASS_TYPE_P (decl)
          && CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (decl))) 
     ? CLASSTYPE_TI_TEMPLATE (TREE_TYPE (decl)) : decl;
 }
index a4d6573491cabec06f7f3702ed99f6e528df27ec..fd17b11586710147086a07c7be45071084a7d7d4 100644 (file)
@@ -1122,7 +1122,7 @@ comptypes (t1, t2, strict)
 
     case METHOD_TYPE:
       if (! comp_except_specs (TYPE_RAISES_EXCEPTIONS (t1),
-                             TYPE_RAISES_EXCEPTIONS (t2), 1))
+                              TYPE_RAISES_EXCEPTIONS (t2), 1))
        return 0;
 
       /* This case is anti-symmetrical!
@@ -1150,7 +1150,7 @@ comptypes (t1, t2, strict)
 
     case FUNCTION_TYPE:
       if (! comp_except_specs (TYPE_RAISES_EXCEPTIONS (t1),
-                             TYPE_RAISES_EXCEPTIONS (t2), 1))
+                              TYPE_RAISES_EXCEPTIONS (t2), 1))
        return 0;
 
       val = ((TREE_TYPE (t1) == TREE_TYPE (t2)