From a30171a0cd1ee936e4df23be98429a742cfc531b Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Thu, 5 Dec 2013 15:16:32 +0100 Subject: [PATCH 1/2] add test --- std/path.d | 3 +++ 1 file changed, 3 insertions(+) diff --git a/std/path.d b/std/path.d index ab8c21d3cf5..2f575bafea1 100644 --- a/std/path.d +++ b/std/path.d @@ -1730,6 +1730,9 @@ unittest { assert (equal(pathSplitter("/foo/bar".dup), ["/", "foo", "bar"])); }); + + // Bugzilla 11691 + static assert(is(typeof(pathSplitter!char().front) == const(char)[])); } From c1251436ba67b39e26f61e54ab79f8ee769fe5e7 Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Thu, 5 Dec 2013 15:22:01 +0100 Subject: [PATCH 2/2] fix Issue 11691 - can't join pathSplitter with pathSeparator - The inferred return type of front had an additional layer of const because it's a const method. --- std/path.d | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/std/path.d b/std/path.d index 2f575bafea1..4e2b15aff8b 100644 --- a/std/path.d +++ b/std/path.d @@ -1544,9 +1544,9 @@ auto pathSplitter(C)(const(C)[] path) @safe pure nothrow static struct PathSplitter { @safe pure nothrow: - @property empty() const { return _empty; } + @property bool empty() const { return _empty; } - @property front() const + @property const(C)[] front() const { assert (!empty, "PathSplitter: called front() on empty range"); return _front; @@ -1577,7 +1577,7 @@ auto pathSplitter(C)(const(C)[] path) @safe pure nothrow } } - @property back() const + @property const(C)[] back() const { assert (!empty, "PathSplitter: called back() on empty range"); return _back; @@ -1732,7 +1732,8 @@ unittest }); // Bugzilla 11691 - static assert(is(typeof(pathSplitter!char().front) == const(char)[])); + // front should return a mutable array of const elements + static assert(is(typeof(pathSplitter!char(null).front) == const(char)[])); }