[Issue 7968] Failing implicit cast, new in 2.059

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 22 17:01:15 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7968



--- Comment #2 from Manu <turkeyman at gmail.com> 2012-04-22 17:02:14 PDT ---
(In reply to comment #1)
> (In reply to comment #0)
> > The chaps on IRC seemed to think this was a bug and I should report it.
> 
> They were wrong.
> 
> void failCast(const(char)*[] arg) {
>     arg[0] = "123".ptr;
> }
> 
> void main() {
>     char*[] x = ["234".dup.ptr];
>     failCast(x); // if this passes then x[0] has type char*
>     assert(x[0][0..3] == "123");  //  and points into the immutable data
> segment
> }
> 
> Change the signature of failCast to
> 
> void failCast(inout(char)*[] arg)
> 
> to get the desired semantics.

I have already changed it so that it works similarly to how you describe, but I
still don't follow why the cast isn't valid?
How does the cast I attempted break the const model?

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


More information about the Digitalmars-d-bugs mailing list