[Issue 17065] New: Unique does not work with private members
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sat Jan  7 06:08:13 PST 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17065
          Issue ID: 17065
           Summary: Unique does not work with private members
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: dransic at gmail.com
This code doesn't compile anymore:
---
import std.typecons : Unique;
struct Foo
{
    private int i;
}
void main()
{
    Unique!Foo foo = new Foo(1);
    foo.i = 2;  // Error: no property 'i' for type 'Unique!(Foo)'
}
---
It compiled before https://github.com/dlang/phobos/pull/4763 was merged. But
the new implementation uses Proxy, which is a template mixin that is
instantiated from std.typecons itself.
If this behaviour is intended, the doc should state it.
--
    
    
More information about the Digitalmars-d-bugs
mailing list