MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test21807.d
blob9f56bf73a90ee265680d45d67b8a8dc4b6d4fb73
1 /*
2 https://issues.dlang.org/show_bug.cgi?id=21807
4 REQUIRED_ARGS: -de
5 TEST_OUTPUT:
6 ---
7 fail_compilation/test21807.d(11): Deprecation: slice of static array temporary returned by `getSArray()` assigned to longer lived variable `this.str`
8 fail_compilation/test21807.d(12): Deprecation: slice of static array temporary returned by `getSArray()` assigned to longer lived variable `this.ca`
9 ---
11 #line 1
13 char[12] getSArray() pure;
15 class Foo
17 string str;
18 char[] ca;
20 this()
22 str = getSArray(); // Should probably be a type error
23 ca = getSArray();
28 TEST_OUTPUT:
29 ---
30 fail_compilation/test21807.d(117): Error: function `test21807.addr(return ref int b)` is not callable using argument types `(int)`
31 fail_compilation/test21807.d(117): cannot pass rvalue argument `S(0).i` of type `int` to parameter `return ref int b`
32 ---
34 #line 100
36 struct S
38 int i;
41 int* addr(return ref int b)
43 return &b;
46 class Foo2
48 int* ptr;
50 this()
52 ptr = addr(S().i); // struct temporary