From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3970A3870C27; Mon, 9 May 2022 12:21:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3970A3870C27 From: "570070308 at qq dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105510] error: initializer element is not constant Date: Mon, 09 May 2022 12:21:58 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: 570070308 at qq dot com 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: 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: Mon, 09 May 2022 12:21:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105510 --- Comment #2 from =E3=80=82 <570070308 at qq dot com> --- (In reply to Richard Biener from comment #1) > As a workaround it works with >=20 > struct Test t=3D(struct Test){1, {3, 4}}; >=20 > I don't think it your way of writing is actually valid though. Yes, I'm not sure that this is a Bug. I meet this error when I'm using macr= o to init a struct. For example: ```test.c struct Test2 { long int x; long int y; }; struct Test { long int x; struct Test2 t; }; #define TEST2_INIT(x, y) ((struct Test2){x, y}) #define TEST_INIT(x) ((struct Test){x, TEST2_INIT(1, 2)}) struct Test test=3DTEST_INIT(0); // error ```=