Skip to content

Commit

Permalink
Merge pull request #2306 from WalterBright/fix13056
Browse files Browse the repository at this point in the history
fix Issue 13056 - [2.066.0-b1] Regression: Error: template std.path.base...
  • Loading branch information
9rnsr committed Jul 7, 2014
2 parents 44ffee8 + daa82fd commit 592eb10
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions std/path.d
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@ auto baseName(R)(R path)
return p2[lastSeparator(p2)+1 .. p2.length];
}

/// ditto
inout(C)[] baseName(C)(inout(C)[] path)
if (isSomeChar!C)
{
/* This overload is necessary because of the DirEntry unit test below;
* as the 'alias this' conflates strings that auto-decode with ranges that do not
*/
return baseName!(inout(C)[])(path);
}

/// ditto
inout(C)[] baseName(CaseSensitive cs = CaseSensitive.osDefault, C, C1)
(inout(C)[] path, in C1[] suffix)
Expand Down Expand Up @@ -379,6 +389,14 @@ unittest

static assert (baseName("dir/file.ext") == "file.ext");
static assert (baseName("dir/file.ext", ".ext") == "file");

struct DirEntry
{
alias name this;
@property string name() { return ""; }
}
DirEntry de;
auto a = de.baseName;
}


Expand Down

0 comments on commit 592eb10

Please sign in to comment.