From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F40F9385DC3E; Wed, 8 Apr 2020 10:11:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F40F9385DC3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586340717; bh=nM0zK+vDmPNrXhwJwyvk/8+uRRaKYyHVcr2OXWE/InY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tThnhVuDwMnU62+FcUSvik5ueiEI7Qz7RFAtHbksN2aY74IRt89dAdcoAmmw2hsgu meGOCHx0E7s+NYd/JHUUn+gkodGcAldyGQBBMj9cceuIUQ6iYAyJqn+c9HCL7bX7Vu W3zkWS8vpuV6+oLNEjCZcT1F+8FNG/BanMdNWjag= From: "ensadc at mailnesia dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55227] designated initializer for char array by string constant Date: Wed, 08 Apr 2020 10:11:56 +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: ensadc at mailnesia 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: cc 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: Wed, 08 Apr 2020 10:11:57 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55227 ensadc at mailnesia dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ensadc at mailnesia dot com --- Comment #4 from ensadc at mailnesia dot com --- This is accepted in `-Wno-pedantic` mode: struct A { int x; char a[10]; }; A a =3D { .x =3D 1, { .a =3D "aaaa" } }; // #1 This is rejected: struct A { int x; char a[10]; }; A a =3D { .x =3D 1, .a =3D "aaaa" }; // #2 It seems that #1 should be rejected, and #2 should be accepted. I suspect that the bug is related to r182391 (which is a fix for PR51458), which added call to `has_designator_problem` in `reshape_init_r`: /* If it's a string literal, then it's the initializer for the array as a whole. Otherwise, continue with normal initialization for array types (one value per array element). */ if (TREE_CODE (stripped_str_init) =3D=3D STRING_CST) { if (has_designator_problem (d, complain)) return error_mark_node; d->cur++; return str_init; }=