From 7565d3e736098d6ab7d1d5ddd8a5e511ea9e4078 Mon Sep 17 00:00:00 2001
From: pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sun, 4 Jun 2006 18:25:40 +0000
Subject: [PATCH] 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.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114361 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/cp/ChangeLog | 6 ++++++
 gcc/cp/rtti.c    | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e4186b9d8640..0d0c6a59b89e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 6242e44c3e94..7a4699671321 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -677,9 +677,11 @@ build_dynamic_cast_1 (tree type, tree expr)
 	  if (tc == REFERENCE_TYPE)
 	    {
 	      tree bad = throw_bad_cast ();
+	      tree neq;
 
 	      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*.  */
-- 
GitLab