From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1C9863857811; Sat, 26 Mar 2022 14:20:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C9863857811 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105050] error: expression '' is not a constant expression Date: Sat, 26 Mar 2022 14:20:57 +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: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org 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: 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: Sat, 26 Mar 2022 14:20:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105050 --- Comment #5 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:ff465bd8a0f0f96a00d3067018442917b194b7af commit r12-7831-gff465bd8a0f0f96a00d3067018442917b194b7af Author: Patrick Palka Date: Sat Mar 26 10:20:18 2022 -0400 c++: diagnosing if-stmt with non-constant branches [PR105050] When an if-stmt is determined to be non-constant because both of its branches are non-constant, we issue a somewhat generic error which, since the error also points to the 'if' token, misleadingly suggests the condition is at fault: constexpr-105050.C:8:3: error: expression =C3=A2=C3=A2 is = not a constant expression 8 | if (p !=3D q && *p < 0) | ^~ This patch clarifies the error message to instead read: constexpr-105050.C:8:3: error: neither branch of =C3=A2if=C3=A2 is a = constant expression 8 | if (p !=3D q && *p < 0) | ^~ PR c++/105050 gcc/cp/ChangeLog: * constexpr.cc (potential_constant_expression_1) : Clarify error message when a if-stmt is non-constant because its branches are non-constant. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/constexpr-105050.C: New test.=