← Back to index
|
Original Bugzilla link
Bug 17251 – Appender.put errors out with const input range elements
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-03-10T17:42:48Z
Last change time
2018-01-05T13:27:59Z
Assigned to
No Owner
Creator
Sönke Ludwig
Comments
Comment #0
by sludwig — 2017-03-10T17:42:48Z
The following snippet: --- import std.array : appender; static struct R { int front() const { return 0; } bool empty() const { return true; } void popFront() {} } auto app = appender!(R[]); const(R)[1] r; app.put(r[0]); app.put(r[]); --- Results in: --- Error: std.array.Appender!(R[]).Appender.put called with argument types (const(R)) matches both: array.d(2821,10): std.array.Appender!(R[]).Appender.put!(const(R)).put(const(R) item) and: array.d(2849,10): std.array.Appender!(R[]).Appender.put!(const(R)).put(const(R) items) Error: template std.array.Appender!(R[]).Appender.put cannot deduce function from argument types !()(const(R)[]), candidates are: array.d(2821,10): std.array.Appender!(R[]).Appender.put(U)(U item) if (canPutItem!U) array.d(2849,10): std.array.Appender!(R[]).Appender.put(Range)(Range items) if (canPutConstRange!Range) array.d(2858,10): std.array.Appender!(R[]).Appender.put(Range)(Range items) if (canPutRange!Range) --- Putting non-const items on the other hand works fine.
Comment #1
by github-bugzilla — 2017-03-29T21:39:34Z
Commits pushed to master at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/c770fb481218e6eb2cd32363ce96de816dc6bdcf
Fix issue 17251 - Appender.put doesn't accept const input range elements. The two overloads taking an element and a const range were conflicting because canPutConstRange is overlapping the definition of canPutItem.
https://github.com/dlang/phobos/commit/23726d63308c97799c6b356be392b466804be1f5
Merge pull request #5264 from s-ludwig/master Fix issue 17251 - Appender.put doesn't accept const input range elements merged-on-behalf-of: H. S. Teoh <
[email protected]
>
Comment #2
by github-bugzilla — 2017-06-17T11:34:13Z
Commits pushed to stable at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/c770fb481218e6eb2cd32363ce96de816dc6bdcf
Fix issue 17251 - Appender.put doesn't accept const input range elements.
https://github.com/dlang/phobos/commit/23726d63308c97799c6b356be392b466804be1f5
Merge pull request #5264 from s-ludwig/master
Comment #3
by github-bugzilla — 2017-08-07T12:26:34Z
Commits pushed to newCTFE at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/c770fb481218e6eb2cd32363ce96de816dc6bdcf
Fix issue 17251 - Appender.put doesn't accept const input range elements.
https://github.com/dlang/phobos/commit/23726d63308c97799c6b356be392b466804be1f5
Merge pull request #5264 from s-ludwig/master
Comment #4
by github-bugzilla — 2018-01-05T13:27:59Z
Commits pushed to dmd-cxx at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/c770fb481218e6eb2cd32363ce96de816dc6bdcf
Fix issue 17251 - Appender.put doesn't accept const input range elements.
https://github.com/dlang/phobos/commit/23726d63308c97799c6b356be392b466804be1f5
Merge pull request #5264 from s-ludwig/master Fix issue 17251 - Appender.put doesn't accept const input range elements merged-on-behalf-of: H. S. Teoh <
[email protected]
>