mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00

* Fix 23722 - Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code * Update test cases
27 lines
995 B
D
27 lines
995 B
D
// REQUIRED_ARGS: -o-
|
|
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/diag15411.d(17): Error: function `diag15411.test15411.__funcliteral_L17_C15` cannot access variable `i` in frame of function `diag15411.test15411`
|
|
fail_compilation/diag15411.d(16): `i` declared here
|
|
fail_compilation/diag15411.d(18): Error: function `diag15411.test15411.__funcliteral_L18_C15` cannot access variable `i` in frame of function `diag15411.test15411`
|
|
fail_compilation/diag15411.d(16): `i` declared here
|
|
fail_compilation/diag15411.d(26): Error: `static` function `diag15411.testNestedFunction.myFunc2` cannot access function `myFunc1` in frame of function `diag15411.testNestedFunction`
|
|
fail_compilation/diag15411.d(25): `myFunc1` declared here
|
|
---
|
|
*/
|
|
|
|
void test15411()
|
|
{
|
|
auto i = 0;
|
|
auto j = (function() { return i; })();
|
|
auto f = function() { return i; };
|
|
}
|
|
|
|
void testNestedFunction ()
|
|
{
|
|
int i = 42;
|
|
|
|
void myFunc1() { assert(i == 42); }
|
|
static void myFunc2 () { myFunc1(); }
|
|
}
|