Commit a0c04f8e by Andrew Pinski Committed by Andrew Pinski

re PR c++/27592 (dynamic cast failure)

2006-06-01  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/27592
        * rtti.c (build_dynamic_cast_1): Call c_common_truthvalue_conversion
        on operand of the COND_EXPR for the null pointer check.

From-SVN: r114361
parent 5c147e22
2006-06-01 Andrew Pinski <pinskia@physics.uc.edu> 2006-06-01 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/27592
* rtti.c (build_dynamic_cast_1): Call c_common_truthvalue_conversion
on operand of the COND_EXPR for the null pointer check.
2006-06-01 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/26740 PR c++/26740
* typeck.c (build_unary_op): Mark the function as being used. * typeck.c (build_unary_op): Mark the function as being used.
......
...@@ -677,9 +677,11 @@ build_dynamic_cast_1 (tree type, tree expr) ...@@ -677,9 +677,11 @@ build_dynamic_cast_1 (tree type, tree expr)
if (tc == REFERENCE_TYPE) if (tc == REFERENCE_TYPE)
{ {
tree bad = throw_bad_cast (); tree bad = throw_bad_cast ();
tree neq;
result = save_expr (result); result = save_expr (result);
return build3 (COND_EXPR, type, result, result, bad); neq = c_common_truthvalue_conversion (result);
return build3 (COND_EXPR, type, neq, result, bad);
} }
/* Now back to the type we want from a void*. */ /* Now back to the type we want from a void*. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment