[Issue 11760] New: Implicit conversion from rvalue T[N] to T[]
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 17 13:46:27 PST 2013
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 at puremagic.com
ReportedBy: peter.alexander.au at gmail.com
--- Comment #0 from Peter Alexander <peter.alexander.au at 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: -------
More information about the Digitalmars-d-bugs
mailing list