Find struct not passed by reference

frame frame86 at live.com
Tue Aug 3 11:31:02 UTC 2021


On Tuesday, 3 August 2021 at 10:25:34 UTC, frame wrote:

> This could work, thanks for the hint.

I was too optimistic. I get the error:

```
struct `std.typecons.Unique!(myType).Unique` is not copyable 
because it is annotated with `@disable`
```

on a line like:

```d
Unique!myType rs = query();
```

which body is:

```d
ref Unique!myType query(A...)(A args)
{
    return queryImpl(args); // also ref to ref, back to creation 
of the struct
}
```

It's not an Unique! problem, I also get the error if I just 
disable the postblit.
Removing the ref from queryImpl! prints the error at query(), so 
it really sees the error just at the line above but why?


More information about the Digitalmars-d-learn mailing list