opCast cannot implicitly convert a.opCast of type X to Y

rumbu rumbu at rumbu.ro
Mon Feb 12 14:33:26 UTC 2018


On Monday, 12 February 2018 at 02:05:16 UTC, aliak wrote:
> From spec: Cast expression: "cast ( Type ) UnaryExpression" 
> converts UnaryExpresssion to Type.
>
> And https://dlang.org/spec/operatoroverloading.html#cast makes 
> no mention of the return type of opCast. One could think that 
> the return type of opCast would be the return type. But it 
> seems it must be the same as the template parameter of opCast 
> else you get a compile error that seems like it can be much 
> better.
>
> - Ali

In my opinion, you should fill a documentation enhancement 
request on issues.dlang.org.


More information about the Digitalmars-d-learn mailing list