Commit 01628e54 by Jason Merrill Committed by Jason Merrill

cp-tree.h (COMPLETE_OR_OPEN_TYPE_P): New macro.

	* cp-tree.h (COMPLETE_OR_OPEN_TYPE_P): New macro.
	* init.c (build_offset_ref): Use it.
	* pt.c (maybe_process_partial_specialization): Use it.
	(instantiate_class_template): Use it.
	* search.c (lookup_base): Use it.

From-SVN: r160398
parent 55cdb6b6
2010-06-07 Jason Merrill <jason@redhat.com> 2010-06-07 Jason Merrill <jason@redhat.com>
* cp-tree.h (COMPLETE_OR_OPEN_TYPE_P): New macro.
* init.c (build_offset_ref): Use it.
* pt.c (maybe_process_partial_specialization): Use it.
(instantiate_class_template): Use it.
* search.c (lookup_base): Use it.
* pt.c (lookup_template_class): Don't mess with * pt.c (lookup_template_class): Don't mess with
DECL_TEMPLATE_INSTANTIATIONS except for partial instantiations. DECL_TEMPLATE_INSTANTIATIONS except for partial instantiations.
......
...@@ -1433,6 +1433,11 @@ struct GTY(()) lang_type { ...@@ -1433,6 +1433,11 @@ struct GTY(()) lang_type {
starting the definition of this type has been seen. */ starting the definition of this type has been seen. */
#define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined) #define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
/* Nonzero means that this type is either complete or being defined, so we
can do lookup in it. */
#define COMPLETE_OR_OPEN_TYPE_P(NODE) \
(COMPLETE_TYPE_P (NODE) || (CLASS_TYPE_P (NODE) && TYPE_BEING_DEFINED (NODE)))
/* Mark bits for repeated base checks. */ /* Mark bits for repeated base checks. */
#define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE)) #define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
......
...@@ -1520,8 +1520,7 @@ build_offset_ref (tree type, tree member, bool address_p) ...@@ -1520,8 +1520,7 @@ build_offset_ref (tree type, tree member, bool address_p)
/* Callers should call mark_used before this point. */ /* Callers should call mark_used before this point. */
gcc_assert (!DECL_P (member) || TREE_USED (member)); gcc_assert (!DECL_P (member) || TREE_USED (member));
if (!COMPLETE_TYPE_P (complete_type (type)) if (!COMPLETE_OR_OPEN_TYPE_P (complete_type (type)))
&& !TYPE_BEING_DEFINED (type))
{ {
error ("incomplete type %qT does not have member %qD", type, member); error ("incomplete type %qT does not have member %qD", type, member);
return error_mark_node; return error_mark_node;
......
...@@ -891,7 +891,7 @@ maybe_process_partial_specialization (tree type) ...@@ -891,7 +891,7 @@ maybe_process_partial_specialization (tree type)
*slot = GGC_NEW (spec_entry); *slot = GGC_NEW (spec_entry);
**slot = elt; **slot = elt;
} }
else if (COMPLETE_TYPE_P (inst) || TYPE_BEING_DEFINED (inst)) else if (COMPLETE_OR_OPEN_TYPE_P (inst))
/* But if we've had an implicit instantiation, that's a /* But if we've had an implicit instantiation, that's a
problem ([temp.expl.spec]/6). */ problem ([temp.expl.spec]/6). */
error ("specialization %qT after instantiation %qT", error ("specialization %qT after instantiation %qT",
...@@ -7700,8 +7700,7 @@ instantiate_class_template (tree type) ...@@ -7700,8 +7700,7 @@ instantiate_class_template (tree type)
if (type == error_mark_node) if (type == error_mark_node)
return error_mark_node; return error_mark_node;
if (TYPE_BEING_DEFINED (type) if (COMPLETE_OR_OPEN_TYPE_P (type)
|| COMPLETE_TYPE_P (type)
|| uses_template_parms (type)) || uses_template_parms (type))
return type; return type;
...@@ -7796,8 +7795,7 @@ instantiate_class_template (tree type) ...@@ -7796,8 +7795,7 @@ instantiate_class_template (tree type)
instantiate it, and that lookup should instantiate the enclosing instantiate it, and that lookup should instantiate the enclosing
class. */ class. */
gcc_assert (!DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern)) gcc_assert (!DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
|| COMPLETE_TYPE_P (TYPE_CONTEXT (type)) || COMPLETE_OR_OPEN_TYPE_P (TYPE_CONTEXT (type)));
|| TYPE_BEING_DEFINED (TYPE_CONTEXT (type)));
base_list = NULL_TREE; base_list = NULL_TREE;
if (BINFO_N_BASE_BINFOS (pbinfo)) if (BINFO_N_BASE_BINFOS (pbinfo))
......
...@@ -216,8 +216,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) ...@@ -216,8 +216,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
/* If BASE is incomplete, it can't be a base of T--and instantiating it /* If BASE is incomplete, it can't be a base of T--and instantiating it
might cause an error. */ might cause an error. */
if (t_binfo && CLASS_TYPE_P (base) if (t_binfo && CLASS_TYPE_P (base) && COMPLETE_OR_OPEN_TYPE_P (base))
&& (COMPLETE_TYPE_P (base) || TYPE_BEING_DEFINED (base)))
{ {
struct lookup_base_data_s data; struct lookup_base_data_s data;
......
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