Bug 8321 – std.range.put doesn't work with RefCounted output range

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-29T21:44:00Z
Last change time
2013-04-24T03:41:43Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Depends on
4617

Comments

Comment #0 by k.hara.pg — 2012-06-29T21:44:53Z
Test case: ---- import std.typecons, std.range; struct S { void put(int[] a){} void put(int n){} } void main() { S s; put(s, 1); // OK put(s, [1]); // OK auto rs = RefCounted!S(); put(rs, 1); // doesn't work put(rs, [1]); // doesn't work } ---- To fix this issue, both Phobos and dmd needs to be fixed. - std.traits.hasMembers doesn't see the members through alias this. - There is no way to check whether a type T has a member xxx or not, while avoiding UFCS. I've conceived following technique, but doesn't work with current dmd. struct T { void put(){} } alias T.put X; // Type.member doesn't test UFCS, // but getting symbol of xxx would work! struct S { T t; alias t this; } alias S.put X; // Getting symbol through alias this doesn't work... I think we need to fix bug 4617.
Comment #1 by k.hara.pg — 2012-06-30T10:18:57Z
Comment #2 by github-bugzilla — 2012-07-01T21:35:30Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/2a1012a1464a17e0242b773e6cc62a6c5fac9c69 fix Issue 8321 - std.range.put doesn't work with RefCounted output range https://github.com/D-Programming-Language/phobos/commit/190a7be000eac31d1e6fe9c9aeaca3c55fa4dd30 Merge pull request #656 from 9rnsr/fix8321 Issue 8321 - std.range.put doesn't work with RefCounted output range
Comment #3 by k.hara.pg — 2013-04-23T23:57:53Z
Comment #4 by github-bugzilla — 2013-04-24T03:39:51Z