From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 740303858D28; Mon, 7 Aug 2023 21:32:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 740303858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691443969; bh=zToIZVGjZXRoy1nQbcahm8mZndobrD6wY5Yt/zQjKko=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xdDjAANwW4kNpyChhJ0PDnqqqKyUfbSfpbypv4aGxXyEeIueT++Nr073pWSY3+Uwb 9z1iZNYFw4uc2N+mPaXCQDO7dUjjxz7TUjaR7hUKuyHXFbq4KmAe4p10vuXzeV0NBb 6VGsGSMVYeEQj3dajuTu7oXi93jahfWKknmQY/Rk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110938] miscompile if implicit special member is deleted and mutable Date: Mon, 07 Aug 2023 21:32:49 +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: unknown X-Bugzilla-Keywords: ABI X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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: short_desc 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=3D110938 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|miscompile if implicit |miscompile if implicit |special member is deleted |special member is deleted |in a subtle way |and mutable --- Comment #1 from Andrew Pinski --- Reduced: ``` struct X { X(X &) =3D delete; X(X&&) =3D delete; X(const X&) =3D default; }; struct Y { #if 1 mutable #endif X x; int n; }; void print(int); Y f(); void g() { print(f().n); } ``` If we change `#if 1` to `#if 0` then GCC does the correct thing.=