]> gcc.gnu.org Git - gcc.git/commitdiff
decl.c (grokdeclarator): Use assert, not internal_error.
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 18 Sep 2002 13:08:34 +0000 (13:08 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 18 Sep 2002 13:08:34 +0000 (13:08 +0000)
cp:
* decl.c (grokdeclarator): Use assert, not internal_error. Don't
ICE with invalid pointers & references.
testsuite:
* g++.old-deja/g++.other/crash32.C: Mark ICE.

From-SVN: r57277

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.other/crash32.C

index ddf626125140c5cff66e53893714e602607fd10d..6d6613f332ea7d7eefa946d3a35148dc9fbbcc0e 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-18  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * decl.c (grokdeclarator): Use assert, not internal_error. Don't
+       ICE with invalid pointers & references.
+
 2002-09-17  Zack Weinberg  <zack@codesourcery.com>
 
        * Make-lang.in: Remove all references to the demangler.
index a18a5856d4830cb9404194b351c58ace01acc4a1..92093a2c5d246cbc8cf63b114660f18c906a28c3 100644 (file)
@@ -10024,7 +10024,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
            break;
            
          default:
-           internal_error ("`%D' as declarator", decl);
+           my_friendly_assert (0, 20020917);
          }
       }
   }
@@ -10903,21 +10903,15 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
 
          if (TREE_CODE (type) == REFERENCE_TYPE)
            {
-             error ("cannot declare %s to references",
-                    TREE_CODE (declarator) == ADDR_EXPR
-                    ? "references" : "pointers");
-             declarator = TREE_OPERAND (declarator, 0);
-             continue;
-           }
-
-         if (ctype
-             && (TREE_CODE (type) == VOID_TYPE
-                 || TREE_CODE (type) == REFERENCE_TYPE))
-           {
-             error ("cannot declare pointer to `%#T' member",
-                       TREE_TYPE (type));
+             error (TREE_CODE (declarator) == ADDR_EXPR
+                    ? "cannot declare reference to `%#T'"
+                    : "cannot declare pointer to `%#T'", type);
              type = TREE_TYPE (type);
            }
+         else if (VOID_TYPE_P (type)
+                  && (ctype || TREE_CODE (declarator) == ADDR_EXPR))
+           error (ctype ? "cannot declare pointer to `%#T' member"
+                    : "cannot declare reference to `%#T'", type);
 
          /* Merge any constancy or volatility into the target type
             for the pointer.  */
@@ -10928,9 +10922,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
 
          if (TREE_CODE (declarator) == ADDR_EXPR)
            {
-             if (TREE_CODE (type) == VOID_TYPE)
-               error ("invalid type: `void &'");
-             else
+             if (!VOID_TYPE_P (type))
                type = build_reference_type (type);
            }
          else if (TREE_CODE (type) == METHOD_TYPE)
index b9ce518dcac97f3a0b71386ac3a916a4d3703ec0..15d47ea8dab597ef43fefe6d2a58a6382b3cdaee 100644 (file)
@@ -1,3 +1,7 @@
+2002-09-18  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.old-deja/g++.other/crash32.C: Mark ICE.
+
 Tue Sep 17 13:59:45 2002  Nicola Pero  <n.pero@mi.flashnet.it>
 
        * objc.dg/comp-types-1.m: New test.
index 98366c1e9104999216745c4f4bd144b3a76ec8aa..9ff4c86fab42e1733562bf21fa5a9bd8d1d50fcb 100644 (file)
@@ -26,7 +26,7 @@ namespace N
   typedef baz<bar> c;
 }
 
-struct z
+struct z // crash test - XFAIL *-*-*
 {
   int a;
 };
This page took 0.126967 seconds and 5 git commands to generate.