From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1B42B3858CDB; Mon, 25 Mar 2024 21:13:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B42B3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711401193; bh=LKeX/vLBY2mHIRy5wQeqY6agyHacuVclHermq6dSa3Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aGNLAu4EOyjMYMUAY5YF0PhTE3ixoAJpgb3JEHEeK+xFyvq25VJxFk8V3dpmkJW6m FRHd/wsU6tMLuA+KfVWYR3GMqxe+at5zSt/0mu/z+34DyH67VufEDApEfDvoZW6nxA E25BcBkfTbBldYlITglWmxkGexowQnJiGnm00CL8= From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110714] constexpr lifetime error: base class this pointer Date: Mon, 25 Mar 2024 21:13:12 +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: 14.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka 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: 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=3D110714 Patrick Palka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |ppalka at gcc dot gnu.org --- Comment #6 from Patrick Palka --- For the original testcase, evaluation of pf->get_this(); yields &heap [0] instead of the expected &heap, which we don't recognize as a valid constex= pr heap pointer thus leading to the error. This heap[0] term gets built from cxx_fold_indirect_ref which folds '*(stru= ct Derived *) &heap' into 'heap[0]' (where 'heap' has type Derived[1]), which doesn't seem like a sound transformation? I'd expect it to get folded to simply 'heap'. Then again this intermediate (Derived *) cast seems unsound in the first pl= ace since we're casting something of type Derived[1]* to Derived*. I don't know what to make of that.=