+2012-10-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/54922
+ * semantics.c (cx_check_missing_mem_inits): Handle anonymous union
+ members.
+
2012-10-23 Jakub Jelinek <jakub@redhat.com>
PR c++/54844
for (i = 0; i <= nelts; ++i)
{
tree index;
+ tree anon_union_init_type = NULL_TREE;
if (i == nelts)
index = NULL_TREE;
else
{
index = CONSTRUCTOR_ELT (body, i)->index;
+ /* Handle anonymous union members. */
+ if (TREE_CODE (index) == COMPONENT_REF
+ && ANON_UNION_TYPE_P (TREE_TYPE (TREE_OPERAND (index, 0))))
+ anon_union_init_type = TREE_TYPE (TREE_OPERAND (index, 0));
/* Skip base and vtable inits. */
- if (TREE_CODE (index) != FIELD_DECL
- || DECL_ARTIFICIAL (index))
+ else if (TREE_CODE (index) != FIELD_DECL
+ || DECL_ARTIFICIAL (index))
continue;
}
- for (; field != index; field = DECL_CHAIN (field))
+ for (; field != index && TREE_TYPE (field) != anon_union_init_type;
+ field = DECL_CHAIN (field))
{
tree ftype;
if (TREE_CODE (field) != FIELD_DECL
+2012-10-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/54922
+ * g++.dg/cpp0x/constexpr-union4.C: New.
+
2012-10-23 Jeff Law <law@redhat.com>
* gcc.c-torture/execute/pr54985.c: New test.
PR debug/54508
* g++.dg/debug/dwarf2/pr54508.C: New.
-
+
2012-10-23 Jakub Jelinek <jakub@redhat.com>
PR c++/54844
--- /dev/null
+// PR c++/54922
+// { dg-do compile { target c++11 } }
+
+class nullable_int
+{
+ bool init_;
+ union {
+ unsigned char for_value_init;
+ int value_;
+ };
+public:
+ constexpr nullable_int() : init_(false), for_value_init() {}
+};