← Back to index
|
Original Bugzilla link
Bug 21703 – std.base64 : decoding a range with one element does not work properly
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-03-12T20:09:51Z
Last change time
2021-03-12T20:12:30Z
Assigned to
No Owner
Creator
Berni44
Comments
Comment #0
by bugzilla — 2021-03-12T20:09:51Z
unittest { struct InputRange { ubyte[] impl = [ 'e', 'a', '=', '=' ]; bool empty() { return impl.length == 0; } ubyte front() { return impl[0]; } void popFront() { impl = impl[1 .. $]; } size_t length() { return impl.length; } } struct OutputRange { ubyte[] result; void put(ubyte b) { result ~= b; } } InputRange ir; OutputRange or; assert(Base64.decode(ir, or) == 1); assert(or.result == "x"); // fails, output is "y" }
Comment #1
by bugzilla — 2021-03-12T20:12:30Z
Oops, sorry, "y" is correct, I made a type in the input...