OSDN Git Service

Fix PR c++/45383
[pf3gnuchains/gcc-fork.git] / gcc / cp / search.c
index d291c08..c02800c 100644 (file)
@@ -170,7 +170,7 @@ accessible_base_p (tree t, tree base, bool consider_local_p)
      public typedef created in the scope of every class.  */
   decl = TYPE_FIELDS (base);
   while (!DECL_SELF_REFERENCE_P (decl))
-    decl = TREE_CHAIN (decl);
+    decl = DECL_CHAIN (decl);
   while (ANON_AGGR_TYPE_P (t))
     t = TYPE_CONTEXT (t);
   return accessible_p (t, decl, consider_local_p);
@@ -447,7 +447,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
 #ifdef GATHER_STATISTICS
   n_calls_lookup_field_1++;
 #endif /* GATHER_STATISTICS */
-  for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+  for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
     {
 #ifdef GATHER_STATISTICS
       n_fields_searched++;
@@ -1335,7 +1335,7 @@ 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 is no such field exists.  */
+   the method vector with name NAME, or -1 if no such field exists.  */
 
 int
 lookup_fnfields_1 (tree type, tree name)
@@ -1361,9 +1361,13 @@ lookup_fnfields_1 (tree type, tree name)
          if (CLASSTYPE_LAZY_MOVE_CTOR (type))
            lazily_declare_fn (sfk_move_constructor, type);
        }
-      else if (name == ansi_assopname(NOP_EXPR)
-              && CLASSTYPE_LAZY_COPY_ASSIGN (type))
-       lazily_declare_fn (sfk_copy_assignment, 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
@@ -1441,6 +1445,18 @@ lookup_fnfields_1 (tree type, tree name)
   return -1;
 }
 
+/* TYPE is a class type. Return the field within the method vector with
+   name NAME, or NULL_TREE if no such field exists.  */
+
+tree
+lookup_fnfields_slot (tree type, tree name)
+{
+  int ix = lookup_fnfields_1 (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.  */
 
@@ -1889,6 +1905,7 @@ check_final_overrider (tree overrider, tree basefn)
        {
          error ("deleted function %q+D", overrider);
          error ("overriding non-deleted function %q+D", basefn);
+         maybe_explain_implicit_delete (overrider);
        }
       else
        {
@@ -1918,6 +1935,11 @@ look_for_overrides (tree type, tree fndecl)
   int ix;
   int found = 0;
 
+  /* A constructor for a class T does not override a function T
+     in a base class.  */
+  if (DECL_CONSTRUCTOR_P (fndecl))
+    return 0;
+
   for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
     {
       tree basetype = BINFO_TYPE (base_binfo);
@@ -2418,13 +2440,10 @@ lookup_conversions_r (tree binfo,
    functions in this node were selected.  This function is effectively
    performing a set of member lookups as lookup_fnfield does, but
    using the type being converted to as the unique key, rather than the
-   field name.
-   If LOOKUP_TEMPLATE_CONVS_P is TRUE, the returned TREE_LIST contains
-   the non-hidden user-defined template conversion functions too.  */
+   field name.  */
 
 tree
-lookup_conversions (tree type,
-                   bool lookup_template_convs_p)
+lookup_conversions (tree type)
 {
   tree convs, tpl_convs;
   tree list = NULL_TREE;
@@ -2451,9 +2470,6 @@ lookup_conversions (tree type,
        }
     }
 
-  if (lookup_template_convs_p == false)
-    tpl_convs = NULL_TREE;
-
   for (; tpl_convs; tpl_convs = TREE_CHAIN (tpl_convs))
     {
       tree probe, next;