This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix constexpr OBJ_TYPE_REF handling on array elts (PR c++/87398)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]