Commit 8e9589bd by Jason Merrill Committed by Jason Merrill

PR c++/84559 - ICE with constexpr VLA.

	* constexpr.c (ensure_literal_type_for_constexpr_object): Check
	for constexpr variable with VLA type.

From-SVN: r258015
parent c2236b9b
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
......
......@@ -112,6 +112,13 @@ ensure_literal_type_for_constexpr_object (tree decl)
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;
}
......
// PR c++/84559
// { dg-do compile { target c++11 } }
void foo(int i)
{
constexpr char x[i] = ""; // { dg-error "" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment