Bug 13098 – std.path functions no longer works with DirEntry
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-11T15:55:00Z
Last change time
2014-08-21T18:22:07Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2014-07-11T15:55:49Z
This regression was introduced by templating baseName and enforcing isSomeString for the argument. Previously baseName took a const(char)[] argument which triggered the implicit conversion of DirEntry to string (via alias name this).
Comment #1 by code — 2014-07-11T16:00:59Z
Introduced by https://github.com/D-Programming-Language/phobos/pull/2169.
The regression applies to all of the following std.path methods.
baseName, extSeparatorPos, extension, isRooted, isAbsolute
The fix is to simply add a const(char)[] function as overload, which also saves some template instantiation in user code.
Comment #2 by code — 2014-07-11T16:02:44Z
*** This issue has been marked as a duplicate of issue 13056 ***
This code has worked with 2.065, but cannot compile with git-head.
import std.path;
void main()
{
static struct DirEntry { string s; alias s this; }
assert(isValidFilename(DirEntry("file.ext")));
}
Comment #6 by k.hara.pg — 2014-07-14T15:41:42Z
(In reply to Kenji Hara from comment #5)
> This code has worked with 2.065, but cannot compile with git-head.
>
> import std.path;
> void main()
> {
> static struct DirEntry { string s; alias s this; }
> assert(isValidFilename(DirEntry("file.ext")));
> }
https://github.com/D-Programming-Language/phobos/pull/2333
Comment #7 by github-bugzilla — 2014-07-15T23:41:16Z