dmd/compiler/test/runnable/test19251.d
2022-07-09 18:53:07 +02:00

20 lines
309 B
D

string result;
struct A
{
int[] a;
immutable(A) fun()
{
result ~= "Yo";
return immutable A([7]);
}
alias fun this;
}
void main()
{
A a;
immutable A b = a; // error: cannot implicitly convert expression a of type A to immutable(A)
assert(result == "Yo");
}