sending shared pointer to struct. message type mismatch

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 21 11:15:55 PDT 2016


On 4/21/16 1:33 PM, ag0aep6g wrote:

> This creates a `shared(S!(M, 2))*`, which is not exactly the same as
> `shared(S!(M, 2)*)`. The pointer is not shared in the former, but it is
> shared in the latter.
>
> I was going to suggest either sending a `shared(TS*)` or receiving a
> `shared(T)*`. But it looks like you can't send a shared pointer. When I
> tried, it got turned into a unshared-pointer-to-shared on the way.

Yes, because Unqual will remove the shared from the type (this is a 
normalization of sorts, to help this kind of situation).

> Changing it to `shared(T)*` on the receiving end works, though. Do that,
> I guess.

This does and doesn't make sense. If you receive a shared(T)*, you 
should be able to receive it into a shared(T*). However, it's possible 
the library doesn't put this together.

-Steve


More information about the Digitalmars-d-learn mailing list