[Issue 11722] Qualifier-only casts should not invoke opCast

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 12 23:34:56 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11722



--- Comment #5 from monarchdodra at gmail.com 2013-12-12 23:34:46 PST ---
(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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list