view gcc/testsuite/g++.old-deja/g++.mike/p12306a.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do run  }
// prms-id: 12306
// a net report of the same problem as 12306

class a {
public:
    int i;
};

class g : virtual public a {
};

class b : virtual public a {
    int j;
};

class c : public g, public b {
};

class d {
public:
    virtual class b* get() {return 0;}
};

class f : public d {
public:
    virtual class b* get() {return &_c;}
    c _c;
};

int main(void) {
    f D;
    b* bp=D.get();
    D._c.i = 42;
    return &D._c.i != &bp->i;
}