aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr82060.C
blob: 3cea930ae05a9d593caf3f44d0afb88deffa8dfa (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
// { dg-do compile }

struct A
{
  char a[1]; // must be char array
};

struct B
{
  A& a() { return ma; } // must be accessed through a getter
  A ma;
};

struct C
{
  B& b() { return mb; } // must be accessed through a getter
  B mb;
};

struct D
{
  virtual A getA() = 0; // must be virtual
};

void
foo(D& d) // The D object must not be created locally
          // (so that getA implementation is not known at compile time?)
{
  C c;
  for (;;) // must be in a loop
    c.b().a() = d.getA();
}