public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "unlvsur at live dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103299] New: accessing incorrect storage for union at constexpr context Date: Wed, 17 Nov 2021 09:08:05 +0000 [thread overview] Message-ID: <bug-103299-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103299 Bug ID: 103299 Summary: accessing incorrect storage for union at constexpr context Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: unlvsur at live dot com Target Milestone: --- struct compile_time_fp { void* ct_fp{}; }; struct foo { union { void* fp{}; compile_time_fp ct_fp; }; }; inline constexpr foo foo_factory() { if (__builtin_is_constant_evaluated()) { return {.ct_fp={}}; } else { return {}; } } constexpr bool test_direct_construction() { foo f{.ct_fp={}}; f.ct_fp; return true; } constexpr bool test_factory_construction() { foo_factory().ct_fp; return true; } static_assert(test_direct_construction()); static_assert(test_factory_construction());//should not fail GCC fails for the 2nd one while msvc and clang all accept the code here.
next reply other threads:[~2021-11-17 9:08 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-17 9:08 unlvsur at live dot com [this message] 2021-11-17 14:28 ` [Bug c++/103299] [10/11/12 Regression] accessing incorrect storage for designated init of anonymous " ppalka at gcc dot gnu.org 2021-11-17 14:37 ` [Bug c++/103299] [11/12 " ppalka at gcc dot gnu.org 2021-11-18 7:46 ` rguenth at gcc dot gnu.org 2021-11-19 17:17 ` ppalka at gcc dot gnu.org 2022-01-20 17:33 ` ppalka at gcc dot gnu.org 2022-03-18 19:17 ` jason at gcc dot gnu.org 2022-03-21 20:47 ` cvs-commit at gcc dot gnu.org 2022-03-21 21:01 ` [Bug c++/103299] [11 " jason at gcc dot gnu.org 2022-03-22 5:18 ` cvs-commit at gcc dot gnu.org 2022-03-26 23:29 ` jason 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-103299-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).