* cp-gimplify.c (cp_fold) [COND_EXPR]: Handle bit-fields.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234384
138bc75d-0d04-0410-961f-
82ee72b054a4
+2016-03-21 Jason Merrill <jason@redhat.com>
+
+ PR c++/70285
+ * cp-gimplify.c (cp_fold) [COND_EXPR]: Handle bit-fields.
+
2016-03-18 Jason Merrill <jason@redhat.com>
PR c++/70139
else
x = fold (x);
+ /* A COND_EXPR might have incompatible types in branches if one or both
+ arms are bitfields. If folding exposed such a branch, fix it up. */
+ if (TREE_CODE (x) != code)
+ if (tree type = is_bitfield_expr_with_lowered_type (x))
+ x = fold_convert (type, x);
+
break;
case CALL_EXPR:
--- /dev/null
+// PR c++/70285
+
+int a;
+
+struct S
+{
+ int i:8;
+} b;
+
+int
+fn1 (bool x)
+{
+ (&fn1 ? b.i : a) = 42;
+ return (&fn1 ? b.i : a);
+}