www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich 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 test(12): Assertion failure

-- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 25 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12467



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-03-25
18:21:49 CET ---
This regression makes the following code print garbage because of the way
stack-tracing works:

-----
string dupit(ref char[3] array)
{
    return array[];
}

void main()
{
    char[3] arr = "foo";
    string str = arr.dupit;
    assert(0, str);  // prints garbage
}
-----

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 25 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12467


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com


--- Comment #2 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-25
19:28:39 EET ---
Introduced in https://github.com/D-Programming-Language/dmd/pull/3336

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