d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag15411.d
blob8b18c19d0276f58fa3d7ff8438356bb6511b976e
1 // REQUIRED_ARGS: -o-
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/diag15411.d(17): Error: function `diag15411.test15411.__funcliteral2` cannot access variable `i` in frame of function `diag15411.test15411`
6 fail_compilation/diag15411.d(16): `i` declared here
7 fail_compilation/diag15411.d(18): Error: function `diag15411.test15411.__funcliteral4` cannot access variable `i` in frame of function `diag15411.test15411`
8 fail_compilation/diag15411.d(16): `i` declared here
9 fail_compilation/diag15411.d(26): Error: `static` function `diag15411.testNestedFunction.myFunc2` cannot access function `myFunc1` in frame of function `diag15411.testNestedFunction`
10 fail_compilation/diag15411.d(25): `myFunc1` declared here
11 ---
14 void test15411()
16 auto i = 0;
17 auto j = (function() { return i; })();
18 auto f = function() { return i; };
21 void testNestedFunction ()
23 int i = 42;
25 void myFunc1() { assert(i == 42); }
26 static void myFunc2 () { myFunc1(); }