On Tuesday, 7 June 2016 at 22:28:57 UTC, Steven Schveighoffer wrote:

It's news to me that while opCast for all other types is for explicit
casting, opCast for bool works for implicit casting.

as ag0... mentioned in another thread, opCast is NOT implicitly being invoked here, but rather explicitly.

That is:

bool x = someStruct; // error
if(someStruct) // explicit opCast!bool


Documented under 'Boolean Operations' at http://dlang.org/spec/operatoroverloading.html#cast

Reply via email to