This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] [PR14033] ICE with parameter of incomplete type
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 6 Feb 2004 20:28:27 +0100
- Subject: [C++ PATCH] [PR14033] ICE with parameter of incomplete type
Hello,
when a function is declared with a parameter with incomplete type, and the
function is later inlined, tree-inline.c ICEs because it does not expect an
error_mark_node as a type. In fact, I can't see a reason why we should
invalidate the type of the parameter if it's incomplete, the diagnostic looks
enough to me.
Tested on i686-pc-linux-gnu, no new regressions, OK for mainline and 3.4?
OK for 3.3? Now or after unfreeze?
Thanks
Giovanni Bajo
cp/
2003-02-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/14033
* decl.c (require_complete_types_for_parms): Do not insert
error_mark_node in the parameter list.
testsuite/
2003-02-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/14033
* g++.dg/other/crash-2.C: New test.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1179
diff -c -3 -p -r1.1179 decl.c
*** decl.c 2 Feb 2004 16:53:02 -0000 1.1179
--- decl.c 6 Feb 2004 18:18:19 -0000
*************** require_complete_types_for_parms (tree p
*** 8467,8474 ****
layout_decl (parms, 0);
DECL_ARG_TYPE (parms) = type_passed_as (TREE_TYPE (parms));
}
- else
- TREE_TYPE (parms) = error_mark_node;
}
}
--- 8467,8472 ----
// { dg-do compile }
// { dg-options "-finline -finline-functions" }
// Contributed by Hans Buchmann <hans dot buchmann at fhso dot ch>
// PR c++/14033: ICE while inlining a function with incomplete parameter
struct A; // { dg-error "forward declaration" }
void foo(A a) {} // { dg-error "incomplete" }
struct A {};
void bar(void)
{
foo(A());
}