--- Comment #15 from Kenji Hara <> 2011-12-25 07:29:50 PST 
Updated patch.

A string literal should be able to bind a reference to static array type.
In the context of ref binding, string literal should work as like static array


void main()
    void foo1(ref string s){}         // ref slice
    void foo2(ref const char[10] s){} // difference of length
    void foo3(ref char[5] s){}        // mutable element

    void foo4(ref const char[5] s)
        assert(s[0] == 'h');
        assert(s[4] == 'o');
    void foo5(ref const ubyte[5] s)
        assert(s[0] == 0xc3);
        assert(s[4] == 0x61);

    static assert(!__traits(compiles, foo1("hello")));
    static assert(!__traits(compiles, foo2("hello")));
    static assert(!__traits(compiles, foo3("hello")));

    import std.conv;
    static assert(!__traits(compiles, parse!int("10") == 10));

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to