[Issue 12467] New: Regression (2.066 git-head): char[] is implicitly convertible to string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 25 10:20:53 PDT 2014


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

           Summary: Regression (2.066 git-head): char[] is implicitly
                    convertible to string
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-25 18:20:51 CET ---
-----
string dupit(ref char[3] array)
{
    return array[];
}

void main()
{
    char[3] arr = "foo";
    string str = arr.dupit;
    assert(str.ptr !is arr.ptr);  // oops
}
-----

DMD 2.065:
$ dmd test.d
> Error: cannot implicitly convert expression (array[]) of type char[] to string

DMD 2.066 git-head:
$ dmd test.d
> core.exception.AssertError at test(12): Assertion failure

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