Following code should work, but doesn't.
struct Variant
{
this(int) pure {}
~this() {} // impure
}
auto makeVar(int n) pure
{
return Variant(1); // line 9
}
void main()
{
auto v = makeVar(1);
}
test.d(9): Error: pure function 'test.makeVar' cannot call impure function 'test.Variant.~this'
Comment #1 by robert.schadek — 2024-12-13T18:40:54Z