February 28, 2011 [Issue 5663] New: std.array.Appender.put bug | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5663 Summary: std.array.Appender.put bug Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2011-02-27 21:57:25 PST --- Following test fails. Appender.put treats const(T)[]/immutable(T)[] argument as general input range. unittest { alias .std.array.Appender!(char[]) StdApp; { StdApp app; app.put("\xE3"); //thrown "Invalid UTF-8 sequence" assert(app.data == "\xE3"); } { StdApp app; app.put(cast(const(char)[])"\xE3"); //thrown "Invalid UTF-8 sequence" assert(app.data == "\xE3"); } { StdApp app; app.put(cast(char[])"\xE3"); //char[] -> ok assert(app.data == "\xE3"); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 28, 2011 [Issue 5663] std.array.Appender.put bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=5663 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-02-27 22:02:45 PST --- Following patch will fix this bug. std/array.d | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/std/array.d b/std/array.d index c0f466c..e0c64f0 100644 --- a/std/array.d +++ b/std/array.d @@ -1196,7 +1196,9 @@ Appends an entire range to the managed array. // note, we disable this branch for appending one type of char to // another because we can't trust the length portion. static if (!(isSomeChar!T && isSomeChar!(ElementType!Range) && - !is(Range == Unqual!(T)[])) && + !is(Range == Unqual!T[]) && + !is(Range == const(T)[]) && + !is(Range == immutable(T)[])) && is(typeof(items.length) == size_t)) { // optimization -- if this type is something other than a string, -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation