Bug 11760 – Implicit conversion from rvalue T[N] to T[]
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-17T13:46:00Z
Last change time
2014-01-28T01:39:11Z
Assigned to
nobody
Creator
peter.alexander.au
Comments
Comment #0 by peter.alexander.au — 2013-12-17T13:46:24Z
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.
Comment #1 by yebblies — 2014-01-28T01:39:11Z
*** This issue has been marked as a duplicate of issue 9279 ***