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.
From-SVN: r221738
+2015-03-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/65556
+ * semantics.c (finish_switch_cond): If the unlowered type is not an
+ enum, use the type of the condition.
+
2015-03-27 Jason Merrill <jason@redhat.com>
PR c++/65509
}
/* 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. */
+2015-03-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/65556
+ * c-c++-common/pr65556.c: New test.
+
2015-03-27 Jan Hubicka <hubicka@ucw.cz>
PR ipa/65600
--- /dev/null
+/* PR c++/65556 */
+/* { dg-do compile } */
+
+struct S
+{
+ long l: 1;
+ long l2: 41;
+ unsigned long ul: 1;
+ unsigned long ul2: 41;
+} s;
+
+void
+fn ()
+{
+ switch (s.l)
+ case 0:;
+ switch (s.ul)
+ case 0:;
+ switch (s.l2)
+ case 0:;
+ switch (s.ul2)
+ case 0:;
+}