diff options
author | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2004-07-05 15:56:10 +0000 |
---|---|---|
committer | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2004-07-05 15:56:10 +0000 |
commit | 030bbecdbb3935ea4728da13d46dc0f0a9ebda4f (patch) | |
tree | cda5bfe77686f5e41b27ad2183b3a1b0d3c8a699 /gcc/cp | |
parent | 2709efd88c169398f2d23305813f6c7f3c3b18f0 (diff) | |
download | gcc-030bbecdbb3935ea4728da13d46dc0f0a9ebda4f.zip gcc-030bbecdbb3935ea4728da13d46dc0f0a9ebda4f.tar.gz gcc-030bbecdbb3935ea4728da13d46dc0f0a9ebda4f.tar.bz2 |
re PR c++/2518 (user-declared operator new hides standard one)
PR c++/2518
* call.c (build_operator_new_call): Look only at global scope.
PR c++/2518
* g++.dg/lookup/new1.C: New test.
From-SVN: r84119
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f611cb3..a760aa9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-07-05 Giovanni Bajo <giovannibajo@gcc.gnu.org> + + PR c++/2518 + * call.c (build_operator_new_call): Look only at global scope. + 2004-07-05 Nathan Sidwell <nathan@codesourcery.com> * call.c (enforce_access): Expect TREE_BINFO. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 82355c29..b698386 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2812,7 +2812,10 @@ build_operator_new_call (tree fnname, tree args, tree *size, tree *cookie_size) if (args == error_mark_node) return args; + /* A global operator new must be looked up only at global scope. */ + push_to_top_level(); fns = lookup_function_nonclass (fnname, args); + pop_from_top_level(); /* Figure out what function is being called. */ cand = perform_overload_resolution (fns, args, &candidates, &any_viable_p); |