From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2DBFF385B519; Sat, 18 Feb 2023 21:19:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DBFF385B519 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676755165; bh=1DKAXjWcFTP3K09NZPZWKzAyQMJmOTHTK6HjQXQ0SRw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cfB6uHrcnWTcjBwud9+YGBddhLYMYz4OC+2ToBhSR0I0lypH0DfXrwpNm+vqZQowD HQ4pgkSkT8aDtj/ODqel6zLXu7Aj9mVaXJFmev4/uV8StBTIzbtSZflG5h2/OCKcd0 ipwBxteC+SM6C4YYETWI1VLhy6DzO1NZeCP9sSvk= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/89741] [9 Regression] static_assert fires when template not instantiated Date: Sat, 18 Feb 2023 21:19:23 +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: 9.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.0 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=3D89741 --- Comment #12 from CVS Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:9944ca17c0766623bce260684edc614def7ea761 commit r13-6133-g9944ca17c0766623bce260684edc614def7ea761 Author: Jason Merrill Date: Fri Feb 10 16:16:45 2023 -0800 c++: static_assert (false) in template [DR2518] For a long time, people have expected to be able to write static_assert (false) in a template and only have it diagnosed if the template is instantiated, but we (and other implementations) gave an er= ror about the uninstantiated template because the standard says that if no valid instantiation of the template is possible, the program is ill-formed, no diagnostic required, and we try to diagnose IFNDR things when feasible. At the meeting last week we were looking at CWG2518, which wanted to specify that an implementation must not accept a program containing a failing #error or static_assert. We also looked at P2593, which proposed allowing static_assert in an uninstantiated template. We ended up combining the= se two in order to avoid requiring implementations to reject programs with static_assert (false) in uninstantiated templates. The committee accepted this as a DR, so I'm making the change to all standard modes. This behavior was also conformant previously, since no diagnostic was required in this case. We continue to diagnose non-constant or otherwise ill-formed conditions= , so no changes to existing tests were needed. DR 2518 PR c++/52809 PR c++/53638 PR c++/87389 PR c++/89741 PR c++/92099 PR c++/104041 PR c++/104691 gcc/cp/ChangeLog: * semantics.cc (finish_static_assert): Don't diagnose in template context. gcc/testsuite/ChangeLog: * g++.dg/DRs/dr2518.C: New test.=