summaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-27 16:46:44 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-27 16:46:44 +0000
commit6e08defbf8aa4bce274e617d823ecd2320b776a1 (patch)
treecfea32e2ad3b2887f553f3e549bb6d48275c8d67 /gcc/cp/semantics.c
parentf3e0be564cdbf3b60e7cc9963269f3d86c0ef796 (diff)
downloadgcc-6e08defbf8aa4bce274e617d823ecd2320b776a1.tar.gz
PR c++/65556
* semantics.c (finish_switch_cond): If the unlowered type is not an enum, use the type of the condition. * c-c++-common/pr65556.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221738 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index f325e41f417..74af7e842c7 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1165,6 +1165,8 @@ finish_switch_cond (tree cond, tree switch_stmt)
}
/* We want unlowered type here to handle enum bit-fields. */
orig_type = unlowered_expr_type (cond);
+ if (TREE_CODE (orig_type) != ENUMERAL_TYPE)
+ orig_type = TREE_TYPE (cond);
if (cond != error_mark_node)
{
/* Warn if the condition has boolean value. */