summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/fail224.d
blob: c52cb431dc76923068f4cd3a9fb4faf6a2639b07 (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
/*
TEST_OUTPUT:
---
fail_compilation/fail224.d(22): Error: need `this` of type `A` to access member `x` from static function `f`
---
*/

int gi;

class A
{
    int x = 42;

    void am()
    {
        static void f()
        {
            class B
            {
                void bm()
                {
                    gi = x;
                }
            }

            (new B).bm();
        }

        f();
    }
}

void main()
{
    (new A).am();
}