I found a problem with this patch--we can't call do_warn_duplicated_branches in build_conditional_expr, because that way the C++-specific codes might leak into the hasher. Instead, I should use operand_equal_p, I think. Let me rework that part of the patch.
Marek