http://d.puremagic.com/issues/show_bug.cgi?id=5747
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #4 from [email protected] 2013-11-03 08:31:45 PST --- Just hit this. IMO, this is a bug: The presence of an opCast should not prevent "qualification-cast", which don't actually change the type. In particular, the problem is that *even* trying to hand write it, it's not possible: //---- import std.traits; struct S { int* p; //prevent implicit cast T opCast(T:bool)() pure const { return false; } T opCast(T)() const if (is(Unqual!T == S)) { return this; //This fails return cast(T) this; //This overflows } } void main() { immutable(S) s; auto b = cast(S)(s); //How to do this? } //---- IMO, a cast to the *same* type (but different quals) should always be defined by the compiler, even if another opCast is defined, unless the use explicitly overrides *that* opCast. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
