[Issue 6519] Problem with inout and type inference of polysemous types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 31 10:30:22 PDT 2011


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



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2011-08-31 10:30:12 PDT ---
I think this is a duplication of bug 3748.

With my patch (https://github.com/D-Programming-Language/dmd/pull/359), the
sample code in comment #0 works correctly.

(In reply to comment #2)
> Should the following compile?
>    int[] x = foo([1,2,3]);
>    immutable(int[]) y = foo([1,2,3]);
>    const(int[]) z = foo([1,2,3]);

D's literals work like polysemous value, but basically they have mutable types.

static assert(is(typeof([1, 2]) == int[]));

Therefore typeof(foo([1, 2])) equals to int[], and only y shouldn't compile,
others should.

-- 
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