https://d.puremagic.com/issues/show_bug.cgi?id=11722
--- Comment #6 from Kenji Hara <[email protected]> 2013-12-12 23:44:33 PST --- (In reply to comment #5) > (In reply to comment #0) > > This is a spin-off issue from bug 5747. > > > > D has a cast syntax for modifying just only the type qualifier of the > > operand. > > > > http://dlang.org/expression#CastExpression > > > > CastExpression: > > cast ( Type ) UnaryExpression > > cast ( CastQual ) UnaryExpression <-- > > cast ( ) UnaryExpression <-- > > Kenji: I'm wondering: Your original post seemed to imply the enhancement was > *only* for qualifier cast. However, the final result seems to be for *any* > kind > of cast, whith matching types. I mean: > > const(S) s; > auto a = cast() s; > auto b = cast(S) s; > > In the case of "a": We have a "CastQual" type cast, and this bypasses the > opCast operator entirelly. > In the case of "b": We have a *Type* cast, but that happens to result only in > a > qualifier change. > > In the case of "b", *should* we call opCast? Please clarify. Yes. And actually, with git-head, following code asserts only in the case of "b". struct S { T opCast(T)() const { assert(0); } } void main() { const(S) s; auto a = cast() s; // bypass opCast auto b = cast(S) s; // call opCast and assert } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
