From 030bbecdbb3935ea4728da13d46dc0f0a9ebda4f Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Mon, 5 Jul 2004 15:56:10 +0000 Subject: 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 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/call.c | 3 +++ 2 files changed, 8 insertions(+) (limited to 'gcc/cp') 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 + + PR c++/2518 + * call.c (build_operator_new_call): Look only at global scope. + 2004-07-05 Nathan Sidwell * 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); -- cgit v1.1