On Monday, 13 June 2022 at 21:45:39 UTC, Paul Backus wrote:
On Monday, 13 June 2022 at 19:48:06 UTC, JG wrote:
Hi,

I reduced my code to the following. Could anyone help me to discover why the line marked with //THIS LINE

causes memcpy to be called, and how can I avoid this?

Reduced further:

```d
import std.sumtype;

struct Tuple
{
        void opAssign(Tuple rhs) {}
}

alias ParseErrorOr = SumType!Tuple;

auto parserOr() {
        ParseErrorOr cur;
        cur = ParseErrorOr(Tuple());
        return cur;
}

void main()
{
        enum a = parserOr();
}
```

The call to `move` is coming from `SumType.opAssign`:

https://github.com/dlang/phobos/blob/v2.100.0/std/sumtype.d#L681

I've filed a bugzilla issue for this here:

https://issues.dlang.org/show_bug.cgi?id=23182

Thanks, for doing this.

Reply via email to