diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2002-09-18 13:08:34 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2002-09-18 13:08:34 +0000 |
commit | dd29188b820fc8bfae31d7aa4bb364858de1126f (patch) | |
tree | 704e26d54cebfc838e71744719a18a543a9adf2a | |
parent | 5e7a8ee032347a12cfc8bcac117b028f4359ae0c (diff) | |
download | gcc-dd29188b820fc8bfae31d7aa4bb364858de1126f.zip gcc-dd29188b820fc8bfae31d7aa4bb364858de1126f.tar.gz gcc-dd29188b820fc8bfae31d7aa4bb364858de1126f.tar.bz2 |
decl.c (grokdeclarator): Use assert, not internal_error.
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
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 26 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/crash32.C | 2 |
4 files changed, 19 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ddf6261..6d6613f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a18a585..92093a2 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b9ce518..15d47ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash32.C b/gcc/testsuite/g++.old-deja/g++.other/crash32.C index 98366c1..9ff4c86 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/crash32.C +++ b/gcc/testsuite/g++.old-deja/g++.other/crash32.C @@ -26,7 +26,7 @@ namespace N typedef baz<bar> c; } -struct z +struct z // crash test - XFAIL *-*-* { int a; }; |