Thread overview
[Issue 7397] New: [Regression] std.path.buildPath can't be used with string[]
Jan 29, 2012
dawg@dawgfoto.de
Jan 30, 2012
Walter Bright
Jan 30, 2012
Kenji Hara
Jan 30, 2012
Kenji Hara
Jan 31, 2012
Kenji Hara
Feb 07, 2012
Kenji Hara
January 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7397

           Summary: [Regression] std.path.buildPath can't be used with
                    string[]
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: dawg@dawgfoto.de


--- Comment #0 from dawg@dawgfoto.de 2012-01-29 14:46:54 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7397


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |INVALID


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-01-29 17:10:35 PST ---
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...)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7397


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-01-29 17:28:12 PST ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7397


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-01-30 15:18:14 PST ---
https://github.com/D-Programming-Language/phobos/pull/412

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7397



--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-01-31 06:50:23 PST ---
buildNormalizedPath() and join() have same issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 06, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7397



--- Comment #5 from github-bugzilla@puremagic.com 2012-02-06 04:13:38 PST ---
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[]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7397


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2012-02-06 19:39:25 PST ---
OK, pull #412 was merged.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------