Commit 8bc6369b by Roger Sayle Committed by Roger Sayle

fold-const.c (fold): Don't require strict type equality...


	* fold-const.c (fold) <COND_EXPR>: Don't require strict type
	equality, instead just prevent replacing a COND_EXPR of non-void
	type by one of its operands of void type.

From-SVN: r75239
parent 34998d6b
2003-12-30 Roger Sayle <roger@eyesopen.com>
* fold-const.c (fold) <COND_EXPR>: Don't require strict type
equality, instead just prevent replacing a COND_EXPR of non-void
type by one of its operands of void type.
2003-12-30 Andreas Schwab <schwab@suse.de> 2003-12-30 Andreas Schwab <schwab@suse.de>
* doc/c-tree.texi: Fix @item vs. @itemx. * doc/c-tree.texi: Fix @item vs. @itemx.
......
...@@ -7869,7 +7869,8 @@ fold (tree expr) ...@@ -7869,7 +7869,8 @@ fold (tree expr)
/* Only optimize constant conditions when the selected branch /* Only optimize constant conditions when the selected branch
has the same type as the COND_EXPR. This avoids optimizing has the same type as the COND_EXPR. This avoids optimizing
away "c ? x : throw", where the throw has a void type. */ away "c ? x : throw", where the throw has a void type. */
if (TREE_TYPE (tem) == TREE_TYPE (t)) if (! VOID_TYPE_P (TREE_TYPE (tem))
|| VOID_TYPE_P (TREE_TYPE (t)))
return pedantic_non_lvalue (tem); return pedantic_non_lvalue (tem);
return t; return t;
} }
......
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