public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "elronnd at elronnd dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94558] New: Designated initializer inside _Generic is misinterpreted Date: Sat, 11 Apr 2020 07:49:39 +0000 [thread overview] Message-ID: <bug-94558-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94558 Bug ID: 94558 Summary: Designated initializer inside _Generic is misinterpreted Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: elronnd at elronnd dot net Target Milestone: --- POC: typedef struct{int _;} A; typedef struct{int _;} B; typedef union { A a; B b; } O; #define NO(o) _Generic((o), \ A: ((O){.a=o}), \ B: ((O){.b=o})) int main() { A a; O o = NO(a); } Generates the error message: incompatible types when initializing type ‘int’ using type ‘A’ {aka ‘struct <anonymous>’} Because it's trying to initialize the '_' field in 'A' with 'a', instead of the 'a' field in 'O'.
next reply other threads:[~2020-04-11 7:49 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-11 7:49 elronnd at elronnd dot net [this message] 2020-04-15 21:06 ` [Bug c/94558] " jsm28 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-94558-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).