From 82f8d4030dd44035ff6b441e1f16c6a38908d039 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Wed, 14 Aug 2019 22:38:21 -0700 Subject: [PATCH] fix array(String) to work with no autodecode --- std/array.d | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/std/array.d b/std/array.d index 49609d20429..4430d996da0 100644 --- a/std/array.d +++ b/std/array.d @@ -260,7 +260,7 @@ Returns: a `dchar[]`, `const(dchar)[]`, or `immutable(dchar)[]` depending on the constness of the input. */ -ElementType!String[] array(String)(scope String str) +CopyTypeQualifiers!(ElementType!String,dchar)[] array(String)(scope String str) if (isNarrowString!String) { import std.utf : toUTF32; @@ -268,7 +268,7 @@ if (isNarrowString!String) /* Unsafe cast. Allowed because toUTF32 makes a new array and copies all the elements. */ - return () @trusted { return cast(ElementType!String[]) temp; } (); + return () @trusted { return cast(CopyTypeQualifiers!(ElementType!String, dchar)[]) temp; } (); } /// @@ -277,7 +277,6 @@ if (isNarrowString!String) import std.range.primitives : isRandomAccessRange; assert("Hello D".array == "Hello D"d); - static assert(isRandomAccessRange!string == false); assert("Hello D"w.array == "Hello D"d); static assert(isRandomAccessRange!dstring == true);