aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-10-03 15:56:25 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-10-03 11:56:25 -0400
commit3bbb73169af5430ee45180feb43f209948e47d2a (patch)
tree0f5b2d27d2c44eea8af314eb05870f62b71a5339
parentc3437800befdb2638d4062b1ae94de4043589df4 (diff)
downloadgcc-3bbb73169af5430ee45180feb43f209948e47d2a.zip
gcc-3bbb73169af5430ee45180feb43f209948e47d2a.tar.gz
gcc-3bbb73169af5430ee45180feb43f209948e47d2a.tar.bz2
typeck.c (build_conditional_expr): Only fold if ifexp is an INTEGER_CST.
* typeck.c (build_conditional_expr): Only fold if ifexp is an INTEGER_CST. From-SVN: r22794
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 23ae369..1c26ef6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
1998-10-03 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (build_conditional_expr): Only fold if ifexp is an
+ INTEGER_CST.
+
* decl2.c (finish_vtable_vardecl): Check DECL_INTERFACE_KNOWN
instead of linkage.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a3c75d9..40b5b7e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5345,7 +5345,7 @@ build_conditional_expr (ifexp, op1, op2)
op2 = convert_for_initialization
(NULL_TREE, result_type, op2, LOOKUP_NORMAL, "converting", NULL_TREE, 0);
- if (TREE_CONSTANT (ifexp))
+ if (TREE_CODE (ifexp) == INTEGER_CST)
return integer_zerop (ifexp) ? op2 : op1;
return convert_from_reference