MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test14238.d
bloba0e4d69b361fb4d2603db4663c15299b5866b698
1 /* REQUIRED_ARGS: -preview=dip1000
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test14238.d(20): Error: scope parameter `fn` may not be returned
5 fail_compilation/test14238.d(28): Error: escaping reference to stack allocated value returned by `&baz`
6 ---
7 */
8 // https://issues.dlang.org/show_bug.cgi?id=14238
10 @safe:
12 alias Fn = ref int delegate() return;
14 ref int foo(return scope Fn fn)
16 return fn(); // Ok
19 ref int foo2(scope Fn fn) {
20 return fn(); // Error
23 ref int bar() {
24 int x;
25 ref int baz() {
26 return x;
28 return foo(&baz);