public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning @ 2020-12-15 22:10 sbergman at redhat dot com 2020-12-16 18:27 ` [Bug c++/98305] " msebor at gcc dot gnu.org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: sbergman at redhat dot com @ 2020-12-15 22:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98305 Bug ID: 98305 Summary: Incomprehensible -Wmismatched-new-delete warning Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sbergman at redhat dot com Target Milestone: --- With recent GCC 11 trunk (at git commit 8dede2411195eb2fd672d8d0c758f94732bd6d77): > $ cat test.cc > #include <cstddef> > template<typename> struct Reference {}; > template<typename> struct S2 { > static void * operator new(std::size_t); > static void operator delete(void *); > S2(); > }; > void f() { new S2<Reference<int>>; } > $ g++ -Wmismatched-new-delete -c test.cc > test.cc: In function ‘void f()’: > test.cc:8:16: warning: ‘static void S2< <template-parameter-1-1> >::operator delete(void*) [with <template-parameter-1-1> = Reference<int>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete] > 8 | void f() { new S2<Reference<int>>; } > | ^~~~~~~~~~~~~~~~~~ > test.cc:8:16: note: returned from ‘static void* S2< <template-parameter-1-1> >::operator new(std::size_t) [with <template-parameter-1-1> = Reference<int>]’ (And oddly enough, the warning disappears when Reference is renamed to e.g. S1.) ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/98305] Incomprehensible -Wmismatched-new-delete warning 2020-12-15 22:10 [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning sbergman at redhat dot com @ 2020-12-16 18:27 ` msebor at gcc dot gnu.org 2020-12-16 18:27 ` msebor at gcc dot gnu.org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: msebor at gcc dot gnu.org @ 2020-12-16 18:27 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98305 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |diagnostic Ever confirmed|0 |1 Last reconfirmed| |2020-12-16 Target Milestone|--- |11.0 CC| |msebor at gcc dot gnu.org --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The warning compares the mangled names of the operators and doesn't interpret template instantiations quite correctly. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/98305] Incomprehensible -Wmismatched-new-delete warning 2020-12-15 22:10 [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning sbergman at redhat dot com 2020-12-16 18:27 ` [Bug c++/98305] " msebor at gcc dot gnu.org @ 2020-12-16 18:27 ` msebor at gcc dot gnu.org 2020-12-17 2:11 ` [Bug c++/98305] spurious -Wmismatched-new-delete on template instance msebor at gcc dot gnu.org ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: msebor at gcc dot gnu.org @ 2020-12-16 18:27 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98305 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Status|NEW |ASSIGNED ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/98305] spurious -Wmismatched-new-delete on template instance 2020-12-15 22:10 [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning sbergman at redhat dot com 2020-12-16 18:27 ` [Bug c++/98305] " msebor at gcc dot gnu.org 2020-12-16 18:27 ` msebor at gcc dot gnu.org @ 2020-12-17 2:11 ` msebor at gcc dot gnu.org 2020-12-17 14:03 ` sbergman at redhat dot com ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: msebor at gcc dot gnu.org @ 2020-12-17 2:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98305 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Incomprehensible |spurious |-Wmismatched-new-delete |-Wmismatched-new-delete on |warning |template instance Keywords| |patch --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562141.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/98305] spurious -Wmismatched-new-delete on template instance 2020-12-15 22:10 [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning sbergman at redhat dot com ` (2 preceding siblings ...) 2020-12-17 2:11 ` [Bug c++/98305] spurious -Wmismatched-new-delete on template instance msebor at gcc dot gnu.org @ 2020-12-17 14:03 ` sbergman at redhat dot com 2021-01-06 20:46 ` cvs-commit at gcc dot gnu.org 2021-01-06 20:47 ` msebor at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: sbergman at redhat dot com @ 2020-12-17 14:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98305 --- Comment #3 from Stephan Bergmann <sbergman at redhat dot com> --- (In reply to Martin Sebor from comment #2) > https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562141.html Thanks; can confirm that fixes my LibreOffice build. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/98305] spurious -Wmismatched-new-delete on template instance 2020-12-15 22:10 [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning sbergman at redhat dot com ` (3 preceding siblings ...) 2020-12-17 14:03 ` sbergman at redhat dot com @ 2021-01-06 20:46 ` cvs-commit at gcc dot gnu.org 2021-01-06 20:47 ` msebor at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2021-01-06 20:46 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98305 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>: https://gcc.gnu.org/g:fd64f348a6b40621dc2bcc743f5fdfb31ed0894c commit r11-6507-gfd64f348a6b40621dc2bcc743f5fdfb31ed0894c Author: Martin Sebor <msebor@redhat.com> Date: Wed Jan 6 13:36:18 2021 -0700 PR c++/98305 spurious -Wmismatched-new-delete on template instance gcc/ChangeLog: PR c++/98305 * builtins.c (new_delete_mismatch_p): New overload. (new_delete_mismatch_p (tree, tree)): Call it. gcc/testsuite/ChangeLog: PR c++/98305 * g++.dg/warn/Wmismatched-new-delete-3.C: New test. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/98305] spurious -Wmismatched-new-delete on template instance 2020-12-15 22:10 [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning sbergman at redhat dot com ` (4 preceding siblings ...) 2021-01-06 20:46 ` cvs-commit at gcc dot gnu.org @ 2021-01-06 20:47 ` msebor at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: msebor at gcc dot gnu.org @ 2021-01-06 20:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98305 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- Committed in r11-6507. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-01-06 20:47 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-15 22:10 [Bug c++/98305] New: Incomprehensible -Wmismatched-new-delete warning sbergman at redhat dot com 2020-12-16 18:27 ` [Bug c++/98305] " msebor at gcc dot gnu.org 2020-12-16 18:27 ` msebor at gcc dot gnu.org 2020-12-17 2:11 ` [Bug c++/98305] spurious -Wmismatched-new-delete on template instance msebor at gcc dot gnu.org 2020-12-17 14:03 ` sbergman at redhat dot com 2021-01-06 20:46 ` cvs-commit at gcc dot gnu.org 2021-01-06 20:47 ` msebor at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).