d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail22366.d
blob675ba831ef6103a9f5f8a6710984cea00fd95291
1 /*
2 REQUIRED_ARGS: -preview=dip1000
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail22366.d(22): Error: scope variable `s` may not be copied into allocated memory
6 fail_compilation/fail22366.d(25): Error: scope variable `s` may not be copied into allocated memory
7 fail_compilation/fail22366.d(26): Error: scope variable `s` may not be copied into allocated memory
8 fail_compilation/fail22366.d(27): Error: scope variable `s` may not be copied into allocated memory
9 fail_compilation/fail22366.d(28): Error: scope variable `s` may not be copied into allocated memory
10 fail_compilation/fail22366.d(31): Error: scope variable `s` may not be copied into allocated memory
11 fail_compilation/fail22366.d(32): Error: scope variable `s` may not be copied into allocated memory
12 ---
15 // Test escaping scope variables through AA keys / values
16 // https://issues.dlang.org/show_bug.cgi?id=22366
17 // https://issues.dlang.org/show_bug.cgi?id=23531
19 void fun(scope string s) @safe
21 int[string] aa;
22 aa[s] ^^= 3;
24 string[string] saa;
25 saa[""] = s;
26 saa[""] ~= s;
27 saa[s] = "";
28 saa[s] ~= "";
30 string[string][string] snaa;
31 snaa[s][""] = "";
32 snaa[""][s] = "";