From: Jason Merrill Date: Sat, 7 Aug 1999 01:22:26 +0000 (+0000) Subject: decl.c (bad_specifiers): It's OK to have an EH spec on a function pointer. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f8e55f34658519d892a5e0b7801b7bf029a41b23;p=gcc.git decl.c (bad_specifiers): It's OK to have an EH spec on a function pointer. * 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a9e045bc6ea..2840d962155 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 1999-08-06 Jason Merrill + * 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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 038b0994615..b3f534bb06f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 357b1d1694d..bab76341663 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index a4d6573491c..fd17b115867 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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)