d: Merge dmd. druntime e770945277, phobos 6d6e0b9b9
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test21807.d
blobaaa56f9709878a1cf002ea86ff0c5fb74fee14bd
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 `addr` 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 fail_compilation/test21807.d(106): `test21807.addr(return ref int b)` declared here
33 ---
35 #line 100
37 struct S
39 int i;
42 int* addr(return ref int b)
44 return &b;
47 class Foo2
49 int* ptr;
51 this()
53 ptr = addr(S().i); // struct temporary