From 55765de4413d1aea5bc847924b5cd2430f4974cb Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 2 Aug 2002 22:42:03 +0000 Subject: [PATCH] init.c (build_member_call): Use build_new_method_call, not build_method_call. * 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 | 5 +++++ gcc/cp/init.c | 19 +++++++++++++------ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/inherit/access3.C | 19 +++++++++++++++++++ 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/inherit/access3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c39ea5a9841..34315e4a89c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-08-02 Mark Mitchell + + * init.c (build_member_call): Use build_new_method_call, not + build_method_call. + 2002-08-02 Krister Walfridsson * Make-lang.in (spew.o, lex.o, pt.o): Add path to parse.h dependencies. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 421a00ac289..6286a227753 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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)))) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e886217df36..84a018fd32f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-08-02 Mark Mitchell + + * g++.dg/inherit/access3.C: New test. + 2002-08-01 Jakub Jelinek * 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 index 00000000000..1862bfc3471 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/access3.C @@ -0,0 +1,19 @@ +// { dg-do compile } + +class __new_alloc { +public: + static void allocate() {} +}; + +template +class __debug_alloc : public _Alloc { +public: + static void allocate(); +}; + +template +void __debug_alloc<_Alloc>::allocate() { + _Alloc::allocate(); +} + +template class __debug_alloc<__new_alloc>; -- 2.30.2