init.c (build_member_call): Use build_new_method_call, not build_method_call.
authorMark Mitchell <mark@codesourcery.com>
Fri, 2 Aug 2002 22:42:03 +0000 (22:42 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 2 Aug 2002 22:42:03 +0000 (22:42 +0000)
* init.c (build_member_call): Use build_new_method_call, not
build_method_call.
* g++.dg/inherit/access3.C: New test.

From-SVN: r56000

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/access3.C [new file with mode: 0644]

index c39ea5a98414b804493e4b2c322dc7f124319028..34315e4a89c2ef37c7584eb095aa1e1bd2883b75 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-02  Mark Mitchell  <mark@codesourcery.com>
+
+       * init.c (build_member_call): Use build_new_method_call, not
+       build_method_call.
+
 2002-08-02  Krister Walfridsson  <cato@df.lth.se>
 
        * Make-lang.in (spew.o, lex.o, pt.o): Add path to parse.h dependencies.
index 421a00ac2897426a9b7bbbb4c55f33104cd437ae..6286a22775378e9f9c371a36ba69c7db1492d664 100644 (file)
@@ -1434,6 +1434,7 @@ build_member_call (type, name, parmlist)
 {
   tree t;
   tree method_name;
+  tree fns;
   int dtor = 0;
   tree basetype_path, decl;
 
@@ -1511,6 +1512,18 @@ build_member_call (type, name, parmlist)
 
   decl = maybe_dummy_object (type, &basetype_path);
 
+  fns = lookup_fnfields (basetype_path, method_name, 0);
+  if (fns)
+    {
+      if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+       BASELINK_FUNCTIONS (fns) = build_nt (TEMPLATE_ID_EXPR,
+                                            BASELINK_FUNCTIONS (fns),
+                                            TREE_OPERAND (name, 1));
+      return build_new_method_call (decl, fns, parmlist,
+                                   /*conversion_path=*/NULL_TREE,
+                                   LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
+    }
+
   /* Convert 'this' to the specified type to disambiguate conversion
      to the function's context.  */
   if (decl == current_class_ref
@@ -1527,12 +1540,6 @@ build_member_call (type, name, parmlist)
 
   if (constructor_name_p (method_name, type))
     return build_functional_cast (type, parmlist);
-  if (lookup_fnfields (basetype_path, method_name, 0))
-    return build_method_call (decl, 
-                             TREE_CODE (name) == TEMPLATE_ID_EXPR
-                             ? name : method_name,
-                             parmlist, basetype_path,
-                             LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
   if (TREE_CODE (name) == IDENTIFIER_NODE
       && ((t = lookup_field (TYPE_BINFO (type), name, 1, 0))))
     {
index e886217df3676ff7faa2b053e29e941eaab17b6d..84a018fd32f23b8dffd51b5bd31cfd6099678aa8 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-02  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/inherit/access3.C: New test.
+
 2002-08-01  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/ia64-visibility-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/inherit/access3.C b/gcc/testsuite/g++.dg/inherit/access3.C
new file mode 100644 (file)
index 0000000..1862bfc
--- /dev/null
@@ -0,0 +1,19 @@
+// { dg-do compile }
+
+class __new_alloc {
+public:
+  static void allocate() {}
+};
+
+template <class _Alloc>
+class __debug_alloc : public _Alloc {
+public:
+  static void allocate();
+};
+
+template <class _Alloc>
+void __debug_alloc<_Alloc>::allocate() {
+  _Alloc::allocate();
+}
+
+template class __debug_alloc<__new_alloc>;