summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/fail224.d
blob: 4bde3700482b0277f6fb84f015ea7ffead8e5972 (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();
}