digitalmars.D.bugs - [Issue 14553] New: The return types of std.array.array for narrow
- via Digitalmars-d-bugs (49/49) May 07 2015 https://issues.dlang.org/show_bug.cgi?id=14553
https://issues.dlang.org/show_bug.cgi?id=14553 Issue ID: 14553 Summary: The return types of std.array.array for narrow strings conflicts with its documentation Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: ttanjo gmail.com The document of std.array.array for narrow string says "This (snip) always returns a dchar[], const(dchar)[], or immutable(dchar)[] depends on the constness of the input." However, array for them always returns dchar[] instead of qualified array. The following example reproduces the problem. I checked it by using dmd trunk in Linux x64. --- import std.stdio; import std.array; import std.traits; import std.typetuple; void main() { foreach(T; TypeTuple!(char, wchar)) { writeln(ReturnType!(array!(T[])).stringof); writeln(ReturnType!(array!(const(T)[])).stringof); writeln(ReturnType!(array!(immutable(T)[])).stringof); } } --- Expected output: dchar[] const(dchar)[] immutable(dchar)[] dchar[] const(dchar)[] immutable(dchar)[] Actual output: dchar[] dchar[] dchar[] dchar[] dchar[] dchar[] --
May 07 2015