From dff1b563b3b6568ed7fca16e435a929f255bce0a Mon Sep 17 00:00:00 2001 From: Volker Reichelt Date: Mon, 22 Aug 2005 08:37:17 +0000 Subject: [PATCH] re PR c++/23089 (internal compiler error: in int_mode_for_mode, at stor-layout.c:251 at -O1) PR c++/23089 * decl.c (require_complete_types_for_parms): Mark incomplete types as invalid. * g++.dg/other/incomplete1.C: New test. From-SVN: r103336 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 10 ++++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/other/incomplete1.C | 7 +++++++ 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/other/incomplete1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bb646060b49..765ce9cc0b5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-08-22 Volker Reichelt + + PR c++/23089 + * decl.c (require_complete_types_for_parms): Mark incomplete types + as invalid. + 2005-08-19 Volker Reichelt * parser.c (cp_parser_nth_token_starts_template_argument_list_p): diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index eb212c27dce..9929eb6b2c2 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8305,14 +8305,16 @@ require_complete_types_for_parms (tree parms) { if (dependent_type_p (TREE_TYPE (parms))) continue; - if (VOID_TYPE_P (TREE_TYPE (parms))) - /* grokparms will have already issued an error. */ - TREE_TYPE (parms) = error_mark_node; - else if (complete_type_or_else (TREE_TYPE (parms), parms)) + if (!VOID_TYPE_P (TREE_TYPE (parms)) + && complete_type_or_else (TREE_TYPE (parms), parms)) { relayout_decl (parms); DECL_ARG_TYPE (parms) = type_passed_as (TREE_TYPE (parms)); } + else + /* grokparms or complete_type_or_else will have already issued + an error. */ + TREE_TYPE (parms) = error_mark_node; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 518c6a00496..5d6a6823659 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-08-22 Volker Reichelt + + PR c++/23089 + * g++.dg/other/incomplete1.C: New test. + 2005-08-22 Ira Rosen * gcc.dg/vect/vect-22.c: Add test for float. All four loops diff --git a/gcc/testsuite/g++.dg/other/incomplete1.C b/gcc/testsuite/g++.dg/other/incomplete1.C new file mode 100644 index 00000000000..cb7970fad1c --- /dev/null +++ b/gcc/testsuite/g++.dg/other/incomplete1.C @@ -0,0 +1,7 @@ +// PR c++/23089 +// Origin: Flash Sheridan +// ICE on incomplete type +// { dg-do compile } +// { dg-options "-O" } + +void foo(struct A) {} // { dg-error "incomplete type|forward declaration" }