summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/inherit/covariant18.C
blob: 31e62165e7ce653353610e20a42e01a6357c4cfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// PR c++/47873
// { dg-do run }

struct Base
{
    virtual ~Base(){}

    virtual Base& This() { return *this; }
};


struct Ent : virtual Base
{
    void *m_Body;

    Ent& This() { return *this; }

    virtual Ent& body()
    {
        return This();
    }

};


struct Msg : virtual Ent
{
    Msg()
    {
        body();
    }

    Msg& This() { return *this; }
};

int main()
{
    Msg m;

    return 0;
}