diff options
author | Arsen Arsenović <arsen@aarsen.me> | 2024-08-01 17:38:15 +0200 |
---|---|---|
committer | Arsen Arsenović <arsen@gcc.gnu.org> | 2024-12-21 20:52:13 +0100 |
commit | 7d83a32aacd6005c0c038c74562e35d70f6a77a8 (patch) | |
tree | 72742da9ae59a8b6eb189da4c08c38e26de01c50 /gcc/fortran/trans-expr.cc | |
parent | d637e6d069ade775a4b61f51fff61fe4cce01c36 (diff) | |
download | gcc-7d83a32aacd6005c0c038c74562e35d70f6a77a8.zip gcc-7d83a32aacd6005c0c038c74562e35d70f6a77a8.tar.gz gcc-7d83a32aacd6005c0c038c74562e35d70f6a77a8.tar.bz2 |
warn-access: ignore template parameters when matching operator new/delete [PR109224]
Template parameters on a member operator new cannot affect its member
status nor whether it is a singleton or array operator new, hence, we
can ignore it for purposes of matching. Similar logic applies to the
placement operator delete.
In the PR (and a lot of idiomatic coroutine code generally), operator
new is templated in order to be able to inspect (some of) the arguments
passed to the coroutine, to make allocation-related decisions. However,
the coroutine implementation will not call a placement delete form, so
it cannot get templated. As a result, when demangling, we have an extra
template DEMANGLE_COMPONENT_TEMPLATE around the actual operator new, but
not operator delete. This terminates new_delete_mismatch_p early.
PR middle-end/109224 - Wmismatched-new-delete false positive with a templated operator new (common with coroutines)
gcc/ChangeLog:
PR middle-end/109224
* gimple-ssa-warn-access.cc (new_delete_mismatch_p): Strip
DEMANGLE_COMPONENT_TEMPLATE from the operator new and operator
after demangling.
gcc/testsuite/ChangeLog:
PR middle-end/109224
* g++.dg/warn/Wmismatched-new-delete-9.C: New test.
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
0 files changed, 0 insertions, 0 deletions