public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-110714-4-RuAIU6aRsl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110714-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110714

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
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 constexpr
heap pointer thus leading to the error.

This heap[0] term gets built from cxx_fold_indirect_ref which folds '*(struct
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 place
since we're casting something of type Derived[1]* to Derived*.  I don't know
what to make of that.

      parent reply	other threads:[~2024-03-25 21:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 11:39 [Bug c++/110714] New: " pkeir at outlook dot com
2023-07-18 12:46 ` [Bug c++/110714] " pinskia at gcc dot gnu.org
2023-07-18 12:58 ` pkeir at outlook dot com
2023-07-18 13:16 ` pkeir at outlook dot com
2024-03-22  0:53 ` redi at gcc dot gnu.org
2024-03-22  0:54 ` redi at gcc dot gnu.org
2024-03-25 21:13 ` ppalka at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110714-4-RuAIU6aRsl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).