Bug 7397 – [Regression] std.path.buildPath can't be used with string[]

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-29T14:46:00Z
Last change time
2012-02-06T19:39:25Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2012-01-29T14:46:54Z
void buildPath(C)(const(C)[][] paths...) { } void foo() { string[] ary = ["a", "b"]; buildPath(ary); } ---- Introduced by fix to dmd issue 4251: http://d.puremagic.com/issues/show_bug.cgi?id=4251 https://github.com/D-Programming-Language/dmd/commit/d3cd1bf6db3689fb16c8f97572ae8bbf92ec9df7
Comment #1 by bugzilla — 2012-01-29T17:10:35Z
The compiler's new behavior is correct, it avoids the infamous "array slicing" problem - in this case, it avoids const data being incorrectly typed as immutable. To fix the example: void buildPath(C)(const(C)[][] paths...) becomes: void buildPath(C)(const(C[])[] paths...)
Comment #2 by k.hara.pg — 2012-01-29T17:28:12Z
(In reply to comment #1) > The compiler's new behavior is correct, it avoids the infamous "array slicing" > problem - in this case, it avoids const data being incorrectly typed as > immutable. > > To fix the example: > > void buildPath(C)(const(C)[][] paths...) > > becomes: > > void buildPath(C)(const(C[])[] paths...) Walter's fix is right, but we should apply the fix to Phobos. So this issue is still opened, because it is a Phobos issue, not dmd's.
Comment #3 by k.hara.pg — 2012-01-30T15:18:14Z
Comment #4 by k.hara.pg — 2012-01-31T06:50:23Z
buildNormalizedPath() and join() have same issue.
Comment #5 by github-bugzilla — 2012-02-06T04:13:38Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/c07fe7c8bac50f2e2a26952691aa66b5fee4ac7e Issue 7397 - [Regression] std.path.buildPath can't be used with string[] https://github.com/D-Programming-Language/phobos/commit/8b4628117428ec2b1113308872f2bcf30dac228b Merge pull request #412 from 9rnsr/fix7397 Issue 7397 - [Regression] std.path.buildPath can't be used with string[]
Comment #6 by k.hara.pg — 2012-02-06T19:39:25Z
OK, pull #412 was merged.