From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 44B4B385B835; Sat, 11 Apr 2020 07:49:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44B4B385B835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586591379; bh=QDF3qY6fO8xJoB5MfSmumf5fCYnEm676znIwVgE0/Q8=; h=From:To:Subject:Date:From; b=X3d60JO/Kix2fGxRfv2STFM3PnPZoybaFE7EtYov54PH6Z1H3XX0slmmNJfGZCT6L fNOubzpo8z+zXO3GQ/2SNGGPHa7cv1uzp/zoHQrJj919uMdakfPISysbj+2IMhvuLT N4zFfYSuhQSar5eEjt9MPIkdF4ZeT0sP0riE1FqY= From: "elronnd at elronnd dot net" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: elronnd at elronnd dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 07:49:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94558 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=3Do}), \ B: ((O){.b=3Do})) int main() { A a; O o =3D NO(a); } Generates the error message: incompatible types when initializing type =E2=80=98int=E2=80=99 using type = =E2=80=98A=E2=80=99 {aka =E2=80=98struct =E2=80=99} Because it's trying to initialize the '_' field in 'A' with 'a', instead of= the 'a' field in 'O'.=