OSDN Git Service

PR c++/45114 - Support C++11 alias-declaration
[pf3gnuchains/gcc-fork.git] / gcc / cp / search.c
index 97f593c..40af661 100644 (file)
@@ -427,7 +427,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
                    field = fields[i--];
                  while (i >= lo && DECL_NAME (fields[i]) == name);
                  if (TREE_CODE (field) != TYPE_DECL
-                     && !DECL_CLASS_TEMPLATE_P (field))
+                     && !DECL_TYPE_TEMPLATE_P (field))
                    field = NULL_TREE;
                }
              else
@@ -478,7 +478,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
       if (DECL_NAME (field) == name
          && (!want_type
              || TREE_CODE (field) == TYPE_DECL
-             || DECL_CLASS_TEMPLATE_P (field)))
+             || DECL_TYPE_TEMPLATE_P (field)))
        return field;
     }
   /* Not found.  */
@@ -1046,7 +1046,7 @@ lookup_field_r (tree binfo, void *data)
   /* If we're looking up a type (as with an elaborated type specifier)
      we ignore all non-types we find.  */
   if (lfi->want_type && TREE_CODE (nval) != TYPE_DECL
-      && !DECL_CLASS_TEMPLATE_P (nval))
+      && !DECL_TYPE_TEMPLATE_P (nval))
     {
       if (lfi->name == TYPE_IDENTIFIER (type))
        {
@@ -1335,10 +1335,11 @@ lookup_conversion_operator (tree class_type, tree type)
 }
 
 /* TYPE is a class type. Return the index of the fields within
-   the method vector with name NAME, or -1 if no such field exists.  */
+   the method vector with name NAME, or -1 if no such field exists.
+   Does not lazily declare implicitly-declared member functions.  */
 
-int
-lookup_fnfields_1 (tree type, tree name)
+static int
+lookup_fnfields_idx_nolazy (tree type, tree name)
 {
   VEC(tree,gc) *method_vec;
   tree fn;
@@ -1348,34 +1349,6 @@ lookup_fnfields_1 (tree type, tree name)
   if (!CLASS_TYPE_P (type))
     return -1;
 
-  if (COMPLETE_TYPE_P (type))
-    {
-      if ((name == ctor_identifier
-          || name == base_ctor_identifier
-          || name == complete_ctor_identifier))
-       {
-         if (CLASSTYPE_LAZY_DEFAULT_CTOR (type))
-           lazily_declare_fn (sfk_constructor, type);
-         if (CLASSTYPE_LAZY_COPY_CTOR (type))
-           lazily_declare_fn (sfk_copy_constructor, type);
-         if (CLASSTYPE_LAZY_MOVE_CTOR (type))
-           lazily_declare_fn (sfk_move_constructor, type);
-       }
-      else if (name == ansi_assopname (NOP_EXPR))
-       {
-         if (CLASSTYPE_LAZY_COPY_ASSIGN (type))
-           lazily_declare_fn (sfk_copy_assignment, type);
-         if (CLASSTYPE_LAZY_MOVE_ASSIGN (type))
-           lazily_declare_fn (sfk_move_assignment, type);
-       }
-      else if ((name == dtor_identifier
-               || name == base_dtor_identifier
-               || name == complete_dtor_identifier
-               || name == deleting_dtor_identifier)
-              && CLASSTYPE_LAZY_DESTRUCTOR (type))
-       lazily_declare_fn (sfk_destructor, type);
-    }
-
   method_vec = CLASSTYPE_METHOD_VEC (type);
   if (!method_vec)
     return -1;
@@ -1445,6 +1418,46 @@ lookup_fnfields_1 (tree type, tree name)
   return -1;
 }
 
+/* TYPE is a class type. Return the index of the fields within
+   the method vector with name NAME, or -1 if no such field exists.  */
+
+int
+lookup_fnfields_1 (tree type, tree name)
+{
+  if (!CLASS_TYPE_P (type))
+    return -1;
+
+  if (COMPLETE_TYPE_P (type))
+    {
+      if ((name == ctor_identifier
+          || name == base_ctor_identifier
+          || name == complete_ctor_identifier))
+       {
+         if (CLASSTYPE_LAZY_DEFAULT_CTOR (type))
+           lazily_declare_fn (sfk_constructor, type);
+         if (CLASSTYPE_LAZY_COPY_CTOR (type))
+           lazily_declare_fn (sfk_copy_constructor, type);
+         if (CLASSTYPE_LAZY_MOVE_CTOR (type))
+           lazily_declare_fn (sfk_move_constructor, type);
+       }
+      else if (name == ansi_assopname (NOP_EXPR))
+       {
+         if (CLASSTYPE_LAZY_COPY_ASSIGN (type))
+           lazily_declare_fn (sfk_copy_assignment, type);
+         if (CLASSTYPE_LAZY_MOVE_ASSIGN (type))
+           lazily_declare_fn (sfk_move_assignment, type);
+       }
+      else if ((name == dtor_identifier
+               || name == base_dtor_identifier
+               || name == complete_dtor_identifier
+               || name == deleting_dtor_identifier)
+              && CLASSTYPE_LAZY_DESTRUCTOR (type))
+       lazily_declare_fn (sfk_destructor, type);
+    }
+
+  return lookup_fnfields_idx_nolazy (type, name);
+}
+
 /* TYPE is a class type. Return the field within the method vector with
    name NAME, or NULL_TREE if no such field exists.  */
 
@@ -1457,6 +1470,17 @@ lookup_fnfields_slot (tree type, tree name)
   return VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
 }
 
+/* As above, but avoid lazily declaring functions.  */
+
+tree
+lookup_fnfields_slot_nolazy (tree type, tree name)
+{
+  int ix = lookup_fnfields_idx_nolazy (complete_type (type), name);
+  if (ix < 0)
+    return NULL_TREE;
+  return VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
+}
+
 /* Like lookup_fnfields_1, except that the name is extracted from
    FUNCTION, which is a FUNCTION_DECL or a TEMPLATE_DECL.  */