diff options
author | Mark Mitchell <mark@codesourcery.com> | 2002-08-02 22:42:03 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2002-08-02 22:42:03 +0000 |
commit | 55765de4413d1aea5bc847924b5cd2430f4974cb (patch) | |
tree | 168eb96b45996d9782b715eabfdb7fbe787d12b8 /gcc | |
parent | ba462c8e9d2fbe607e1b9c3f9bf05dee1148fe37 (diff) | |
download | gcc-55765de4413d1aea5bc847924b5cd2430f4974cb.zip gcc-55765de4413d1aea5bc847924b5cd2430f4974cb.tar.gz gcc-55765de4413d1aea5bc847924b5cd2430f4974cb.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/init.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/inherit/access3.C | 19 |
4 files changed, 41 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c39ea5a..34315e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 421a00a..6286a22 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 e886217d..84a018f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..1862bfc --- /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 _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>; |