+2018-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84031
+ * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore
+ recursive calls that return ret.
+ (cp_finish_decomp): Ignore unnamed bitfields.
+
2018-01-23 Jason Merrill <jason@redhat.com>
PR c++/82249 - wrong mismatched pack length error.
{
bool member_seen = false;
for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
- if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_ARTIFICIAL (field)
+ || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
continue;
else if (ret)
return type;
tree t = find_decomp_class_base (loc, TREE_TYPE (base_binfo), ret);
if (t == error_mark_node)
return error_mark_node;
- if (t != NULL_TREE)
+ if (t != NULL_TREE && t != ret)
{
if (ret == type)
{
}
else if (orig_ret != NULL_TREE)
return t;
- else if (ret == t)
- /* OK, found the same base along another path. We'll complain
- in convert_to_base if it's ambiguous. */;
else if (ret != NULL_TREE)
{
error_at (loc, "cannot decompose class type %qT: its base "
goto error_out;
}
for (tree field = TYPE_FIELDS (btype); field; field = TREE_CHAIN (field))
- if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_ARTIFICIAL (field)
+ || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
continue;
else
eltscnt++;
}
unsigned int i = 0;
for (tree field = TYPE_FIELDS (btype); field; field = TREE_CHAIN (field))
- if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_ARTIFICIAL (field)
+ || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
continue;
else
{
2018-01-25 Jakub Jelinek <jakub@redhat.com>
+ PR c++/84031
+ * g++.dg/cpp1z/decomp36.C: New test.
+
PR middle-end/83977
* c-c++-common/gomp/pr83977-1.c: Add -w to dg-options.
--- /dev/null
+// PR c++/84031
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A { unsigned char : 1, a1 : 1, a2 : 2, : 1, a3 : 3; };
+struct B { unsigned char : 1, : 7; };
+struct C : B { constexpr C () : c1 (1), c2 (2), c3 (3) {} unsigned char : 1, c1 : 1, c2 : 2, : 1, c3 : 3; };
+struct D : C { constexpr D () {} unsigned char : 1, : 7; };
+
+int
+main ()
+{
+ static constexpr A a { 1, 2, 3 };
+ const auto &[a1, a2, a3] = a; // { dg-warning "only available with" "" { target c++14_down } }
+ static_assert (a1 == 1 && a2 == 2 && a3 == 3, "");
+ static constexpr D d;
+ const auto &[d1, d2, d3] = d; // { dg-warning "only available with" "" { target c++14_down } }
+ static_assert (d1 == 1 && d2 == 2 && d3 == 3, "");
+}