On 11/11/24 9:23 AM, Simon Martin wrote:
Hi Jason,
On 6 Nov 2024, at 20:47, Jason Merrill wrote:
On 11/6/24 2:23 PM, Simon Martin wrote:
Even though this PR is very close to PR117101, it's not addressed by
the
fix I made through r15-4958-g5821f5c8c89a05 because
cxx_placement_new_fn
has the very same issue as std_placement_new_fn_p used to have.
This patch fixes the issue exactly the same, by checking the first
parameter against NULL_TREE. I considered somehow sharing code
between
the two *_placement_new_fn* static functions, but it looked pointless
since the shared part ("the second parameter is the last one, and a
pointer") is unlikely to be useful elsewhere.
It seems those two functions are intended to test the exact same
thing: whether the argument is ::operator new(size_t, void*).
I think cxx_placement_new_fn should just be
return (cxx_dialect >= cxx20 && std_placement_new_fn_p (fndecl));
and some of the tests in cxx_placement_new_fn move into
std_placement_new_fn_p to accommodate callers that e.g. don't already
know we're dealing with operator new.
Thanks for the suggestion, makes sense.
I did not realise that some of the tests in those functions were
actually redundant (like the tree code or global namespace ones, implied
by DECL_NAMESPACE_SCOPE_P and IDENTIFIER_NEW_OP_P) and made them look
more different than they really are.
The attached patch has been successfully tested on x86_64-pc-linux-gnu.
OK for trunk?
OK.