class.c (add_method): Always build an OVERLOAD for using-decls.
authorJason Merrill <jason@redhat.com>
Sun, 4 Mar 2012 00:53:30 +0000 (19:53 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 4 Mar 2012 00:53:30 +0000 (19:53 -0500)
* class.c (add_method): Always build an OVERLOAD for using-decls.
* search.c (lookup_member): Handle getting an OVERLOAD for a
single function.

From-SVN: r184873

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/search.c

index 6d73ea813e22964239943d0bba749c3a3b588ea7..4674ba7b4395a37e93c9c0fe25a3de4b5be8a1e1 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-03  Jason Merrill  <jason@redhat.com>
+
+       * class.c (add_method): Always build an OVERLOAD for using-decls.
+       * search.c (lookup_member): Handle getting an OVERLOAD for a
+       single function.
+
 2012-03-02  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/51989
index 5d834d9ae5d4ee03a2f9d0e78ac449269c2898d7..6ed4cde6b51a4d8052435158a4e1151224e73944 100644 (file)
@@ -1117,9 +1117,13 @@ add_method (tree type, tree method, tree using_decl)
     return false;
 
   /* Add the new binding.  */
-  overload = build_overload (method, current_fns);
-  if (using_decl && TREE_CODE (overload) == OVERLOAD)
-    OVL_USED (overload) = true;
+  if (using_decl)
+    {
+      overload = ovl_cons (method, current_fns);
+      OVL_USED (overload) = true;
+    }
+  else
+    overload = build_overload (method, current_fns);
 
   if (conv_p)
     TYPE_HAS_CONVERSION (type) = 1;
index e48dcec05890c739c0163313fd18f98d57773662..a1f8a3db173a7dde16d71b8923dbf37415e754e3 100644 (file)
@@ -1250,10 +1250,12 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type,
     only the first call to "f" is valid.  However, if the function is
     static, we can check.  */
   if (rval && protect 
-      && !really_overloaded_fn (rval)
-      && !(TREE_CODE (rval) == FUNCTION_DECL
-          && DECL_NONSTATIC_MEMBER_FUNCTION_P (rval)))
-    perform_or_defer_access_check (basetype_path, rval, rval);
+      && !really_overloaded_fn (rval))
+    {
+      tree decl = is_overloaded_fn (rval) ? get_first_fn (rval) : rval;
+      if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+       perform_or_defer_access_check (basetype_path, decl, decl);
+    }
 
   if (errstr && protect)
     {