OSDN Git Service

* decl.c (grokdeclarator): Diagnose qualifiers on non-member
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Feb 2000 09:48:18 +0000 (09:48 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Feb 2000 09:48:18 +0000 (09:48 +0000)
function type, rather than ICE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32132 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c

index 6a161ed..36b8144 100644 (file)
@@ -1,3 +1,8 @@
+2000-02-24  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * decl.c (grokdeclarator): Diagnose qualifiers on non-member
+       function type, rather than ICE.
+
 2000-02-23  Jason Merrill  <jason@casey.cygnus.com>
 
        * decl.c (grokdeclarator): Call decl_type_access_control.
index 6b3df7f..cafe393 100644 (file)
@@ -10788,14 +10788,19 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
        }
       else if (quals)
        {
-         tree dummy = build_decl (TYPE_DECL, declarator, type);
          if (ctype == NULL_TREE)
            {
-             my_friendly_assert (TREE_CODE (type) == METHOD_TYPE, 159);
-             ctype = TYPE_METHOD_BASETYPE (type);
+             if (TREE_CODE (type) != METHOD_TYPE)
+               cp_error ("invalid qualifiers on non-member function type");
+             else
+               ctype = TYPE_METHOD_BASETYPE (type);
+           }
+         if (ctype)
+           {
+             tree dummy = build_decl (TYPE_DECL, declarator, type);
+             grok_method_quals (ctype, dummy, quals);
+             type = TREE_TYPE (dummy);
            }
-         grok_method_quals (ctype, dummy, quals);
-         type = TREE_TYPE (dummy);
        }
 
       return type;