* constexpr.c (ensure_literal_type_for_constexpr_object): Check
for constexpr variable with VLA type.
From-SVN: r258015
+2018-02-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/84559 - ICE with constexpr VLA.
+ * constexpr.c (ensure_literal_type_for_constexpr_object): Check
+ for constexpr variable with VLA type.
+
2018-02-26 Jakub Jelinek <jakub@redhat.com>
PR c++/84558
cp_function_chain->invalid_constexpr = true;
}
}
+ else if (DECL_DECLARED_CONSTEXPR_P (decl)
+ && variably_modified_type_p (type, NULL_TREE))
+ {
+ error ("%<constexpr%> variable %qD has variably-modified type %qT",
+ decl, type);
+ decl = error_mark_node;
+ }
}
return decl;
}
--- /dev/null
+// PR c++/84559
+// { dg-do compile { target c++11 } }
+
+void foo(int i)
+{
+ constexpr char x[i] = ""; // { dg-error "" }
+}