------- Comment #7 from pinskia at gcc dot gnu dot org 2006-05-21 00:30 -------
And here is the patch which fixes this (it was very simple to figure out what
was going wrong):
I don't have time to regression test it.
[kudzu:trunk/gcc/cp] pinskia% svn diff rtti.c
Index: rtti.c
===================================================================
--- rtti.c (revision 113936)
+++ rtti.c (working copy)
@@ -677,9 +677,12 @@ build_dynamic_cast_1 (tree type, tree ex
if (tc == REFERENCE_TYPE)
{
tree bad = throw_bad_cast ();
+ tree neq;
result = save_expr (result);
- return build3 (COND_EXPR, type, result, result, bad);
+ neq = build2 (NE_EXPR, boolean_type_node, result,
+ cp_convert (TREE_TYPE (result),
integer_zero_node));
+ return build3 (COND_EXPR, type, neq, result, bad);
}
/* Now back to the type we want from a void*. */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27592