MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test23112.d
blob9bbab80e48ce93a575fb6d270703c0c96aa0751c
1 /* REQUIRED_ARGS: -betterC
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test23112.d(106): Error: function `test23112.bar` is `@nogc` yet allocates closure for `bar()` with the GC
5 fail_compilation/test23112.d(108): function `test23112.bar.f` closes over variable `a`
6 fail_compilation/test23112.d(106): `a` declared here
7 ---
8 */
10 // https://issues.dlang.org/show_bug.cgi?id=23112
12 #line 100
14 struct Forward(alias F)
16 auto call()() { return F(); }
19 auto bar(int a) nothrow @safe
21 auto f()
23 return a;
25 return Forward!f();
28 extern(C) void main()
30 assert(bar(3).call() == 3);