On 28-10-17 16:37, Gerald Nunn wrote:

On Sat, 28 Oct 2017 14:57:21 +0200, Mike Wey wrote:

this line:

ProfilePreferenceRow row =
cast(ProfilePreferenceRow)lbSide.getSelectedRow();

fails with dmd since getSelectedRow returns null and that then triggers
an assert when calling a member function.

With ldc it just calls the function while this == null and ends up
executing return cast(ProfilePreferenceRow)super, and returning null.

Since you can't define the opCast as a ufcs function and a static
doesn't have access to this the ldc behavior seens the desired behavior.

Thanks as always Mike, I saw your thread on the dlang forum about this as well. Hopefully it can be resolved in some way that doesn't involve a new compiler version. :)

For now it doesn't look like that's possible. We might have to revert
the opCast and bring it back in 3.8, when the change has landed in all
three compilers.