From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6972B385841E; Fri, 4 Nov 2022 13:11:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6972B385841E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667567461; bh=LjM26JrWtR+cLF2ZfKUoeu3cVmrJkWiEniDYd9TsgIA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bfESCtCOtsEhiOUR44X/qzvF87ghuqjaUhHAnM7Dgzkk4bwrVGwK5EYnTBWSnjQvj FBQTWjRmArjtQEpoZHHcxioQbohQAk0eLNMWjFXutuu//0KvKSqhaXDsOJB4anucTz SDtS+c3EpR6XSaFcKJylWNq6IPB412XZVFtVz4H0= From: "aaron at aaronballman dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/86369] constexpr const char* comparison fails Date: Fri, 04 Nov 2022 13:10: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: 8.1.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: aaron at aaronballman dot com 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: cc 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=3D86369 Aaron Ballman changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aaron at aaronballman dot = com --- Comment #9 from Aaron Ballman --- (In reply to Jason Merrill from comment #8) > (In reply to Nicolas Lesser from comment #1) > > For clarity, b1 shouldn't compile. > >=20 > > [lex.string]p16 says: "whether successive evaluations of a string-liter= al > > yield the same or a different object is unspecified." > >=20 > > [expr.const]p2 says: "An expression e is a core constant expression unl= ess > > the evaluation of e, [...], would evaluate one of the following express= ions: > > [...]; a relational or equality operator where the result is unspecifie= d;" >=20 > I think the second quote refers to places in [expr.eq] that say "the resu= lt > is unspecified", not to all instances of unspecified behavior in the > standard. Doesn't [expr.eq] make it unspecified though? [expr.eq]p6 says: "If two operands compare equal, the result is true for th= e =3D=3D operator and false for the !=3D operator. If two operands compare unequal, = the result is false for the =3D=3D operator and true for the !=3D operator. Oth= erwise, the result of each of the operators is unspecified." If it is unspecified whether a subsequent string literal evaluation produces the same object or a different object then it's unspecified whether the two operands will or won't compare equal, so the result of the operators is also unspecified.=