re PR c++/10635 (ICE (segfault) when dereferencing an incomplete type casted from a void pointer)

PR c++/10635
	* typeck.c (build_c_cast): Check that the destination type is
	complete.

	PR c++/10635
	* g++.dg/expr/cast1.C: New test.

[[Split portion of a mixed commit.]]

From-SVN: r67840.2
This commit is contained in:
Mark Mitchell 2003-06-12 17:22:29 +00:00 committed by Mark Mitchell
parent 54da776f2d
commit 79b59cc3d3
4 changed files with 18 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2003-06-12 Mark Mitchell <mark@codesourcery.com>
PR c++/10635
* typeck.c (build_c_cast): Check that the destination type is
complete.
2003-06-11 Mark Mitchell <mark@codesourcery.com>
PR c++/10432

View file

@ -5189,6 +5189,10 @@ build_c_cast (type, expr)
value = convert_to_void (value, /*implicit=*/NULL);
return value;
}
if (!complete_type_or_else (type, NULL_TREE))
return error_mark_node;
/* Convert functions and arrays to pointers and
convert references to their expanded types,
but don't convert any other types. If, however, we are

View file

@ -1,3 +1,8 @@
2003-06-12 Mark Mitchell <mark@codesourcery.com>
PR c++/10635
* g++.dg/expr/cast1.C: New test.
2003-06-12 Roger Sayle <roger@eyesopen.com>
* gcc.dg/builtins-21.c: New test case.

View file

@ -0,0 +1,3 @@
struct S; // { dg-error "forward" }
void f(S* p) { ((S) (*p)); } // { dg-error "" }