summaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-03-09 20:34:10 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-03-09 20:34:10 +0100
commit8c30a5105f004e885ae81edbf9c1607547bd4ace (patch)
treead67b3505d09efcb012641d1816d48aa0e3e2fdf /gcc/cp/semantics.c
parent9a9ba8d9b1292607bc97da712976937c4d81909d (diff)
downloadgcc-8c30a5105f004e885ae81edbf9c1607547bd4ace.tar.gz
re PR c++/39371 (Incorrectly rejects switch((unsigned int)boolvar))
PR c++/39371 * semantics.c (finish_switch_cond): Don't call get_unwidened. * decl.c (finish_case_label): Pass SWITCH_STMT_TYPE as 3rd argument instead of TREE_TYPE (cond). * g++.dg/opt/switch2.C: Add -w to dg-options. * g++.dg/warn/Wswitch-1.C: Adjust expected warnings. * g++.dg/warn/switch1.C: New test. * g++.dg/other/switch3.C: New test. From-SVN: r144732
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5f01a83c463..eb5d25ae80a 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -945,8 +945,6 @@ finish_switch_cond (tree cond, tree switch_stmt)
tree orig_type = NULL;
if (!processing_template_decl)
{
- tree index;
-
/* Convert the condition to an integer or enumeration type. */
cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, true);
if (cond == NULL_TREE)
@@ -963,18 +961,6 @@ finish_switch_cond (tree cond, tree switch_stmt)
cond = perform_integral_promotions (cond);
cond = maybe_cleanup_point_expr (cond);
}
-
- if (cond != error_mark_node)
- {
- index = get_unwidened (cond, NULL_TREE);
- /* We can't strip a conversion from a signed type to an unsigned,
- because if we did, int_fits_type_p would do the wrong thing
- when checking case values for being in range,
- and it's too hard to do the right thing. */
- if (TYPE_UNSIGNED (TREE_TYPE (cond))
- == TYPE_UNSIGNED (TREE_TYPE (index)))
- cond = index;
- }
}
if (check_for_bare_parameter_packs (cond))
cond = error_mark_node;