blob: b76a3a08c091201eacc96ef4b18c7415920940b3 (
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
37
|
/*
REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
fail_compilation/fail19965.d(36): Error: address of variable `f` assigned to `a` with longer lifetime
---
*/
// https://issues.dlang.org/show_bug.cgi?id=19965
struct Buffer
{
int[10] data;
int[] getData() @safe return
{
return data[];
}
}
struct Foo()
{
Buffer buffer;
int[] toArray() @safe return
{
return buffer.getData;
}
}
int[] a;
void main() @safe
{
Foo!() f;
a = f.toArray;
}
|