digitalmars.D.bugs - [Issue 13623] New: std.typecons.Proxy doesn't work inside classes
- via Digitalmars-d-bugs (35/35) Oct 16 2014 https://issues.dlang.org/show_bug.cgi?id=13623
https://issues.dlang.org/show_bug.cgi?id=13623 Issue ID: 13623 Summary: std.typecons.Proxy doesn't work inside classes Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: code dawg.eu cat > bug.d << CODE import std.typecons, std.traits; class Foo { private int value; mixin Proxy!value; this(int n){ value = n; } } unittest { auto a = new Foo(10), b = new Foo(10); assert(a == b); // Proxy should override Object.opEquals a = 13; } CODE dmd -unittest -main -run bug ---- I think it's reasonable for Proxy to only work inside structs, but there should be a check in the mixin template. static assert(!is(typeof(this) == class), "Proxy cannot be used inside classes."); --
Oct 16 2014