Bug 12467 – Regression (2.066 git-head): char[] is implicitly convertible to string

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-25T10:20:00Z
Last change time
2014-04-18T08:54:06Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2014-03-25T10:20:51Z
----- 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
Comment #1 by andrej.mitrovich — 2014-03-25T10:21:49Z
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 } -----
Comment #2 by dlang-bugzilla — 2014-03-25T10:28:39Z
Comment #3 by k.hara.pg — 2014-04-16T10:44:23Z
Comment #4 by github-bugzilla — 2014-04-18T08:54:05Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4993a93ce4afc99a13c63f8223798249bb8f11ed fix Issue 12467 - char[] is implicitly convertible to string https://github.com/D-Programming-Language/dmd/commit/05e3f244f036c180cb812146c2829c77c096a8ba Merge pull request #3461 from 9rnsr/fix12467 [REG2.066a] Issue 12467 - char[] is implicitly convertible to string