Debian Codegraph @

gcc/testsuite/gdc.test/compilable/scope_tuple_expansion.d

raw
1 // REQUIRED_ARGS: -preview=dip1000
2
3 // Reduced from `std.systime`.
4 // Tuple expansion can trip up scope checking with errors like:
5 // Error: scope variable `__tup4` assigned to `found` with longer lifetime
6
7 struct Tuple(T...)
8 {
9 T t;
10 alias t this;
11 }
12
13 Tuple!(int*, int) find(return scope int* x) @safe
14 {
15 assert(0);
16 }
17
18 void fromISOExtString(scope int* str) @safe
19 {
20 int* found = str.find()[0];
21 }