From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2AE5B3858C2D; Mon, 29 Jan 2024 17:12:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AE5B3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706548343; bh=5KXGX5ZCHqUqggttu5RWWn5oMh6+UuM/+CO9AeSTS2s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AW/B0qDIAcE61Y1lTYHER8ONfAdek1pP9y5zUAaIaYPQ9RjuwpVbjoMN05pCMliSy /6YKtLidZCb0nprkz330MMQBhM2mRdWMcOgsUr9nhUQ27jWJeDgFka0ltqFsBzUCoX +uccQ4c1Ag/P+cxKFGkdsoYNfgXS2I6cv2L9kGKY= From: "bugdal at aerifal dot cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113653] Failure to diagnose use of (non-constant-expr) const objects in static initializers Date: Mon, 29 Jan 2024 17:12:22 +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: unknown X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: bugdal at aerifal dot cx X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113653 --- Comment #6 from Rich Felker --- I'm aware of the allowance to accept "other forms". It's unfortunately underspecified (does the implementation need to be specific in what forms? document them per the normal rules for implementation-defined behavior? etc= .) but indeed it exists. Regardless, at least -pedantic should diagnose this, because it's a big foo= tgun for writing code that is not valid C, that only works with certain compilers that implement C++-like behavior in C. I would also be happy with a separate warning option controlling it, named something like like -Wextended-constant-expressions.=