www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11760] New: Implicit conversion from rvalue T[N] to T[]

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11760

           Summary: Implicit conversion from rvalue T[N] to T[]
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: peter.alexander.au gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au gmail.com> 2013-12-17
13:46:24 PST ---
char[10] f()
{
    char[10] x;
    return x;
}

string g()
{
    return f();
}

This compiles, but it shouldn't as g() will point to garbage.

I noticed this when using std.digest.sha:

string foo(string s)
{
    import std.digest.sha;
    return s.sha1Of.toHexString;
}

toHexString returns a char[N], so foo() returns garbage because of this bug.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2013
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11760


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from yebblies <yebblies gmail.com> 2014-01-28 20:39:11 EST ---
*** This issue has been marked as a duplicate of issue 9279 ***

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