OSDN Git Service

* cp-tree.h (COMPLETE_OR_OPEN_TYPE_P): New macro.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jun 2010 20:42:37 +0000 (20:42 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jun 2010 20:42:37 +0000 (20:42 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/init.c
gcc/cp/pt.c
gcc/cp/search.c

index 7119ddd..3220230 100644 (file)
@@ -1,5 +1,11 @@
 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.
 
index 5efe279..f507a21 100644 (file)
@@ -1433,6 +1433,11 @@ struct GTY(()) lang_type {
    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))
 
index 1f3e803..66451b1 100644 (file)
@@ -1520,8 +1520,7 @@ build_offset_ref (tree type, tree member, bool address_p)
   /* 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;
index fd93b1b..b62a9bc 100644 (file)
@@ -891,7 +891,7 @@ maybe_process_partial_specialization (tree type)
                  *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",
@@ -7700,8 +7700,7 @@ instantiate_class_template (tree type)
   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;
 
@@ -7796,8 +7795,7 @@ instantiate_class_template (tree 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))
index e308821..d69d415 100644 (file)
@@ -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
      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;