+2020-02-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
+ * constexpr.c (reduced_constant_expression_p): Don't crash on a null
+ field.
+
2020-02-24 Martin Sebor <msebor@redhat.com>
PR c++/93804
element. */
if (!reduced_constant_expression_p (val))
return false;
+ /* Empty class field may or may not have an initializer. */
+ for (; field && idx != field;
+ field = next_initializable_field (DECL_CHAIN (field)))
+ if (!is_really_empty_class (TREE_TYPE (field),
+ /*ignore_vptr*/false))
+ return false;
if (field)
- {
- /* Empty class field may or may not have an initializer. */
- for (; idx != field;
- field = next_initializable_field (DECL_CHAIN (field)))
- if (!is_really_empty_class (TREE_TYPE (field),
- /*ignore_vptr*/false))
- return false;
- field = next_initializable_field (DECL_CHAIN (field));
- }
+ field = next_initializable_field (DECL_CHAIN (field));
}
/* There could be a non-empty field at the end. */
for (; field; field = next_initializable_field (DECL_CHAIN (field)))
+2020-02-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
+ * g++.dg/cpp2a/constexpr-init16.C: New test.
+ * g++.dg/cpp2a/constexpr-init17.C: New test.
+
2020-02-26 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/93843
--- /dev/null
+// PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
+// { dg-do compile { target c++2a } }
+
+struct empty { };
+
+struct foo {
+ [[no_unique_address]] empty x;
+ constexpr foo() : x{} { }
+};
+
+struct bar : foo {
+ using foo::foo;
+};
+
+constexpr bar a{};
--- /dev/null
+// PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
+// { dg-do compile { target c++2a } }
+
+struct empty { };
+
+struct foo {
+ [[no_unique_address]] empty x, x2, x3;
+ constexpr foo() : x{}, x2{} { }
+};
+
+struct bar : foo {
+ using foo::foo;
+};
+
+constexpr bar a{};