From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BC1FD3858005; Thu, 4 Jan 2024 01:58:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC1FD3858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704333531; bh=d1L3X/LFD78A4SZqF4SPx4gRRTDYpprNpQdC8JMAlZ4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lIwGWo9fV/p5jeqROzzmqCF0SVYxExgqHGYsa+2Jv9v/r0v0EW6xazaC640Ish8uu zdaSxOiC8qXChEByPKw1iHNTbxvpuIlPB8Tfo4uf6tAjLGJ791b62Ivpdd4QTnqDd7 vQQywA4Qp1YL7yh1p5qmVhZw2SjnwCWfCKe8s+8k= From: "de34 at live dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113200] std::char_traits::move is not constexpr when the argument is a string literal Date: Thu, 04 Jan 2024 01:58:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: de34 at live dot cn 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=3D113200 Jiang An changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |de34 at live dot cn --- Comment #9 from Jiang An --- (In reply to Peter Dimov from comment #3) > I think that the compiler is correct; string literal address comparisons > aren't constant expressions. Clang gives the same error: > https://godbolt.org/z/xPWEf4z63. This looks weird... It seems that `+"abc" =3D=3D +"def"` is never unspecifi= ed (must be false, but Clang rejects it in constant evaluation), while `"abcd" + 1 = =3D=3D +"bcd"` is unspecified. It's unclear to me whether we can practically detect all kinds of unspecifiedness in pointer comparision involving string literals.=