http://d.puremagic.com/issues/show_bug.cgi?id=8321

           Summary: std.range.put doesn"t work with RefCounted output
                    range
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara <k.hara...@gmail.com> 2012-06-29 21:44:53 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to