* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160398
138bc75d-0d04-0410-961f-
82ee72b054a4
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
DECL_TEMPLATE_INSTANTIATIONS except for partial instantiations.
starting the definition of this type has been seen. */
#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. */
#define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
/* Callers should call mark_used before this point. */
gcc_assert (!DECL_P (member) || TREE_USED (member));
- if (!COMPLETE_TYPE_P (complete_type (type))
- && !TYPE_BEING_DEFINED (type))
+ if (!COMPLETE_OR_OPEN_TYPE_P (complete_type (type)))
{
error ("incomplete type %qT does not have member %qD", type, member);
return error_mark_node;
*slot = GGC_NEW (spec_entry);
**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
problem ([temp.expl.spec]/6). */
error ("specialization %qT after instantiation %qT",
if (type == error_mark_node)
return error_mark_node;
- if (TYPE_BEING_DEFINED (type)
- || COMPLETE_TYPE_P (type)
+ if (COMPLETE_OR_OPEN_TYPE_P (type)
|| uses_template_parms (type))
return type;
instantiate it, and that lookup should instantiate the enclosing
class. */
gcc_assert (!DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
- || COMPLETE_TYPE_P (TYPE_CONTEXT (type))
- || TYPE_BEING_DEFINED (TYPE_CONTEXT (type)));
+ || COMPLETE_OR_OPEN_TYPE_P (TYPE_CONTEXT (type)));
base_list = NULL_TREE;
if (BINFO_N_BASE_BINFOS (pbinfo))
/* If BASE is incomplete, it can't be a base of T--and instantiating it
might cause an error. */
- if (t_binfo && CLASS_TYPE_P (base)
- && (COMPLETE_TYPE_P (base) || TYPE_BEING_DEFINED (base)))
+ if (t_binfo && CLASS_TYPE_P (base) && COMPLETE_OR_OPEN_TYPE_P (base))
{
struct lookup_base_data_s data;