mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
22 lines
373 B
D
22 lines
373 B
D
// REQUIRED_ARGS: -c
|
|
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/fail10666.d(16): Error: variable `fail10666.foo10666.s1` has scoped destruction, cannot build closure
|
|
---
|
|
*/
|
|
|
|
|
|
struct S10666
|
|
{
|
|
int val;
|
|
~this() {}
|
|
}
|
|
|
|
void foo10666(S10666 s1)
|
|
{
|
|
auto f1 = (){ return () => s1.val; }(); // NG
|
|
|
|
S10666 s2;
|
|
auto f2 = (){ return () => s2.val; }(); // (should be NG)
|
|
}
|