From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E39F3857020; Fri, 1 Sep 2023 16:55:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E39F3857020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693587341; bh=zHdxc5eHvizZz8y8FK7Pvf/q9zYJREcjEjTN1wOHvXQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bZv0PScJYVsGrNIcpJa0lAOXTy65Gk84wZqm3eHYeWZLBQXJJYnzBY8QZpO6U7jMR 2d2iUg0kay0K1D1D8uBTg6OnrvRHT2WdUmUTEgTtKE97EJ4ZQ95Lm2mNexFrohZAu9 NF4p5CXx2CWZB0/91Ykb2gCXkQatZlyNMsczYyic= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111269] Confusing location of error in source code Date: Fri, 01 Sep 2023 16:55:41 +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: 13.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: everconfirmed keywords bug_status cf_reconfirmed_on 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=3D111269 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2023-09-01 --- Comment #1 from Andrew Pinski --- It is pointing to the whole expression and just the outermost operator, || . Now the C++ front-end gives a better location and information on why it is = not a constant expression: : In function 'int main()': :11:26: error: non-constant condition for static assertion 11 | _Static_assert(0 || 7 > x, ""); | ~~^~~~~~~~ :11:33: error: the value of 'x' is not usable in a constant express= ion 11 | _Static_assert(0 || 7 > x, ""); | ^ :9:13: note: 'int x' is not const 9 | int x =3D 42; | ^ The C front-end could do better ...=