www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Converting stringized array to dstring[]

Hi everyone,

I've stumbled on another possible bug:
-----------------
import std.stdio;
import std.conv;

void main() {
     "[  \"test\"  ]".to!(dstring[]).writeln;
}
-----------------

It gives following error:
-----------------
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(222): Error: 
template std.conv.toImpl cannot deduce function from argument 
types !(dstring[])(string), candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(493):        
std.conv.toImpl(T, S)(S value) if (isImplicitlyConvertible!(S, T) 
&& !isEnumStrToStr!(S, T) && !isNullToStr!(S, T))
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(607):        
std.conv.toImpl(T, S)(ref S s) if (isStaticArray!S)
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(623):        
std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, 
T) && is(typeof(S.init.opCast!T()) : T) && !isExactSomeString!T 
&& !is(typeof(T(value))))
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(674):        
std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, 
T) && is(T == struct) && is(typeof(T(value))))
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(723):        
std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, 
T) && is(T == class) && is(typeof(new T(value))))
/dlang/dmd/linux/bin64/../../src/phobos/std/conv.d(222):        
... (11 more, -v to show) ...
onlineapp.d(5): Error: template instance 
`std.conv.to!(dstring[]).to!string` error instantiating
-----------------

Link to code: https://run.dlang.io/is/ymJXFc

Any idea why we don't support dstring/string -> dstring[] 
conversion?
Funny enough, wstring and simple string to wstring[] is working 
as expected.

Thank you,
Alexandru.
Feb 24