Commit 05c602a1 by Jason Merrill Committed by Jason Merrill

PR c++/85285 - ICE with flexible array after substitution.

	* pt.c (instantiate_class_template_1): Check for flexible array in
	union.

From-SVN: r259277
parent 4b512659
2018-04-10 Jason Merrill <jason@redhat.com>
PR c++/85285 - ICE with flexible array after substitution.
* pt.c (instantiate_class_template_1): Check for flexible array in
union.
2018-04-09 Paolo Carlini <paolo.carlini@oracle.com> 2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/85227 PR c++/85227
......
...@@ -10904,6 +10904,14 @@ instantiate_class_template_1 (tree type) ...@@ -10904,6 +10904,14 @@ instantiate_class_template_1 (tree type)
cxx_incomplete_type_error (r, rtype); cxx_incomplete_type_error (r, rtype);
TREE_TYPE (r) = error_mark_node; TREE_TYPE (r) = error_mark_node;
} }
else if (TREE_CODE (rtype) == ARRAY_TYPE
&& TYPE_DOMAIN (rtype) == NULL_TREE
&& (TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE))
{
error ("flexible array member %qD in union", r);
TREE_TYPE (r) = error_mark_node;
}
} }
/* If it is a TYPE_DECL for a class-scoped ENUMERAL_TYPE, /* If it is a TYPE_DECL for a class-scoped ENUMERAL_TYPE,
......
// PR c++/85285
template<typename T> union A
{
T x; // { dg-error "flexible array" }
};
A<int[]> a;
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