Debian Codegraph @

gcc/testsuite/gdc.test/compilable/test23097.d

raw
1 /* https://issues.dlang.org/show_bug.cgi?id=23097
2 REQUIRED_ARGS: -verrors=simple -verrors=spec
3 TEST_OUTPUT:
4 ---
5 (spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable
6 (spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable
7 (spec:1) compilable/test23097.d(14): Error: generated function `test23097.S23097.opAssign(S23097 p)` is not callable using argument types `(const(S23097))`
8 (spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable
9 (spec:1) compilable/test23097.d(14): `struct S23097` does not define a copy constructor for `const(S23097)` to `S23097` copies
10 ---
11 */
12 void emplaceRef(UT, Args)(UT chunk, Args args)
13 {
14 static if (__traits(compiles, chunk = args))
15 chunk = args;
16 }
17
18 struct CpCtor23097(T)
19 {
20 T* payload;
21 this(ref inout typeof(this)) { }
22 ref opAssign(typeof(this)) { }
23 }
24
25 struct S23097
26 {
27 CpCtor23097!int payload;
28 }
29
30 void test23097(S23097 lhs, const S23097 rhs)
31 {
32 emplaceRef(lhs, rhs);
33 }