decl.c (grokdeclarator): Diagnose qualifiers on non-member function type, rather...
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 24 Feb 2000 09:48:18 +0000 (09:48 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 24 Feb 2000 09:48:18 +0000 (09:48 +0000)
* decl.c (grokdeclarator): Diagnose qualifiers on non-member
function type, rather than ICE.

From-SVN: r32132

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

index 6a161ed02e76eeee5aab6b1bcf51bdfe903ec9b0..36b8144dc13530a3195677b0727910fa2794bb2c 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 6b3df7ff3a59891be5ed0b2a9306f2d3b1caa9b9..cafe3938b16156bf7511f9ca4979faa73a45c534 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;