===================================================================
@@ -382,7 +382,8 @@ build_value_init_noctor (tree type, tsubst_flags_t
SFINAE-enabled. */
if (CLASS_TYPE_P (type))
{
- gcc_assert (!TYPE_HAS_COMPLEX_DFLT (type));
+ gcc_assert (!TYPE_HAS_COMPLEX_DFLT (type)
+ || errorcount != 0);
if (TREE_CODE (type) != UNION_TYPE)
{
===================================================================
@@ -0,0 +1,12 @@
+// PR c++/59269
+// { dg-require-effective-target c++11 }
+
+union U
+{
+ int& i = 0; // { dg-error "reference" }
+};
+
+void foo()
+{
+ U();
+}