dmd/compiler/test/compilable/test23097.d
Royal Simpson Pinto 45e4a09a3e
feat(errors): enable verrors=context globally (#20576)
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2025-01-03 05:17:59 +08:00

33 lines
1.1 KiB
D

/* https://issues.dlang.org/show_bug.cgi?id=23097
REQUIRED_ARGS: -verrors=simple -verrors=spec
TEST_OUTPUT:
---
(spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable
(spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable
(spec:1) compilable/test23097.d(14): Error: generated function `test23097.S23097.opAssign(S23097 p)` is not callable using argument types `(const(S23097))`
(spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable
(spec:1) compilable/test23097.d(14): `struct S23097` does not define a copy constructor for `const(S23097)` to `S23097` copies
---
*/
void emplaceRef(UT, Args)(UT chunk, Args args)
{
static if (__traits(compiles, chunk = args))
chunk = args;
}
struct CpCtor23097(T)
{
T* payload;
this(ref inout typeof(this)) { }
ref opAssign(typeof(this)) { }
}
struct S23097
{
CpCtor23097!int payload;
}
void test23097(S23097 lhs, const S23097 rhs)
{
emplaceRef(lhs, rhs);
}