Bug 9403 – Implicit conversion from char[N] to string with templated functions
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-26T06:51:45Z
Last change time
2019-08-29T21:52:55Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Vladimir Panteleev
Comments
Comment #0 by dlang-bugzilla — 2013-01-26T06:51:45Z
The following unittest compiles and fails, but shouldn't compile:
char[4] f()() { char[4] buf; buf[] = "Drox"; return buf; }
string g() { return f(); }
unittest { assert(g() == "Drox"); }
May be related to issue 9402.
Comment #1 by pro.mathias.lang — 2019-08-29T17:41:37Z
Nowadays this yields:
```
f1.d(2): Error: escaping reference to stack allocated value returned by f()
```
Comment #2 by dlang-bugzilla — 2019-08-29T21:52:55Z
Thanks. It's better to use WORKSFORME when it's not clear what caused the fix.