From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7EBCD381FE66; Thu, 6 Oct 2022 12:39:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7EBCD381FE66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665059942; bh=iNvMR9wXqFUtIDnGm+6ohfHoRfgOMIee5Xm98hYQsps=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZoOa3xJaVljKeFz9D/6Gw3mPoPQA/8vdYW5ad42K0prDGkAKgNeJ3gMNTU//qXyey RPUYGT9mFwUCS1vt+71WUN4GsEegddKv4NCJgVnziNhKZcAEyBjd7N7ViROHosK5p+ Jwwxjqrg3EIFeBehdC3oqFHtT/P939jlze9P9QsA= From: "vanyacpp at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107161] gcc doesn't constant fold member if any other member is mutable Date: Thu, 06 Oct 2022 12:39:02 +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.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vanyacpp at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107161 --- Comment #2 from Ivan Sorokin --- > Do constexpr/consteval work in such circumstances? Yes, constexpr works for variables like "p.a": extern constexpr mytype p =3D {1, 2}; int foo() { constexpr int t =3D p.a + 10; return t; } foo(): mov eax, 11 ret https://godbolt.org/z/K9a69E4ar=