From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 286063857C7C; Thu, 4 Nov 2021 23:43:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 286063857C7C From: "wjwray at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55227] designated initializer for char array by string constant Date: Thu, 04 Nov 2021 23:43:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: wjwray at gmail dot com X-Bugzilla-Status: NEW 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: attachments.created Message-ID: In-Reply-To: References: 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: Thu, 04 Nov 2021 23:43:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55227 --- Comment #11 from Will Wray --- Created attachment 51737 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51737&action=3Dedit Proposed patch Nov 4 Sent to gcc-patches for review https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583379.html This patch aims to fix PR 55227; two underlying bugs that have caused: (1) Rejection of valid designated initialization of char array fields by string literals (a) when enclosed in optional braces or (b) unbraced when the string literal is shorter than the target char array field. (2) Acceptance of an invalid designator appearing within the braces of a braced string literal, in which case the 'designator' was entirely ignored and the string literal treated as a positional initializer.=