https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101140
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW I was thinking we might want to perform two-phase name lookup for
new-expressions like we do for other operator expressions, wherein unqualified
lookup is performed at template definition time, saved inside the expression
(via DEPENDENT_OPERATOR_TYPE) and then reused at instantiation time.
But name lookup for a new-expression doesn't do unqualified lookup, it does
qualified lookup in the global namespace ::. And unlike true two-phase name
lookup which prevents operator overloads declared after the template definition
from being considered, it seems GCC/Clang/MSVC all consider later-declared
global operator new declarations during instantiation of a new-expression:
https://godbolt.org/z/o6r9MYbKc.
So it seems two-phase name lookup isn't appropriate for new-expressions, and
something like your idea is the way to go? I wonder what Jason thinks.