public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Marek Polacek <polacek@redhat.com>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ PATCH] Fix constexpr OBJ_TYPE_REF handling on array elts (PR c++/87398)
Date: Tue, 25 Sep 2018 14:57:00 -0000	[thread overview]
Message-ID: <CADzB+2nc+62ioqFcPNJY7SKxsfQBMuXC=Xi-45V_P6zoWDBHbQ@mail.gmail.com> (raw)
In-Reply-To: <20180925071754.GX8250@tucnak>

On Tue, Sep 25, 2018 at 3:17 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> ARRAY_REF is a handled component, so when a virtual call is on an array
> element (or some component thereof), the loop to look through handled
> components will look through the ARRAY_REFs too and then TREE_TYPE (obj)
> might be an ARRAY_TYPE.  The code wants to look at the class type instead
> though.

Yeah, I think looping through handled components is wrong here; given
something like

struct A
{
  virtual void f();
};

struct B
{
  A a;
} b;

int main()
{
  b.a.f();
}

Looking through all handled components would give us "b", which has no
virtual functions.

I think we need to be more specific about what we're expecting here.

Jason

  parent reply	other threads:[~2018-09-25 14:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25  7:30 Jakub Jelinek
2018-09-25 14:32 ` Marek Polacek
2018-09-25 14:57 ` Jason Merrill [this message]
2018-09-25 14:58   ` Jakub Jelinek
2018-09-25 15:15     ` Jason Merrill
2018-09-25 15:26       ` Jakub Jelinek
2018-09-25 15:47         ` Jason Merrill

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='CADzB+2nc+62ioqFcPNJY7SKxsfQBMuXC=Xi-45V_P6zoWDBHbQ@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=polacek@redhat.com \
    /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).