public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "foldy at rmki dot kfki.hu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100370] New: [11.1.0 regression] Incorrect warning for placement new Date: Sat, 01 May 2021 11:54:38 +0000 [thread overview] Message-ID: <bug-100370-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100370 Bug ID: 100370 Summary: [11.1.0 regression] Incorrect warning for placement new Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: foldy at rmki dot kfki.hu Target Milestone: --- With g++ 11.1.0: tmp> cat test.cc #include <new> int main() { struct s1 { int iv[4]; }; struct s2 { union { char* cp; int* ip; }; }; s2 b; b.ip=new int[8]; new (b.ip+4) s1; } tmp> g++ -c test.cc test.cc: In function 'int main()': test.cc:10:12: warning: placement new constructing an object of type 'main()::s1' and size '16' in a region of type 'main()::s2' and size '0' [-Wplacement-new=] 10 | new (b.ip+4) s1; | ~~~~^~ test.cc:8:6: note: at offset 16 from 'b' declared here 8 | s2 b; | ^ g++ 10.2.1 is OK.
next reply other threads:[~2021-05-01 11:54 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-01 11:54 foldy at rmki dot kfki.hu [this message] 2021-05-03 7:57 ` [Bug c++/100370] [11/12 Regression] " rguenth at gcc dot gnu.org 2021-05-03 16:48 ` msebor at gcc dot gnu.org 2021-07-28 7:06 ` [Bug c++/100370] [11/12 Regression] Incorrect -Wplacement-new with union rguenth at gcc dot gnu.org 2022-01-20 13:57 ` rguenth at gcc dot gnu.org 2022-04-06 12:14 ` jason at gcc dot gnu.org 2022-04-07 1:29 ` jason at gcc dot gnu.org 2022-04-11 12:38 ` cvs-commit at gcc dot gnu.org 2022-04-21 7:49 ` [Bug c++/100370] [11 " rguenth at gcc dot gnu.org 2023-05-29 10:04 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-100370-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).