Bug 7641 – std.typecons.Proxy incorrectly allows implicit conversion to class

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-03T22:11:00Z
Last change time
2015-06-09T05:10:39Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2012-03-03T22:11:32Z
import std.typecons; void main() { class C {} auto a = Typedef!C(new C); C b = a; // accepts-invalid } This is a dmd bug, because opBinaryRight runs unexpectedly. Reduced test case: mixin template Proxy(alias a) { auto ref opBinaryRight(string op, B)(auto ref B b) { return mixin("b "~op~" a"); } } struct Typedef(T) { private T Typedef_payload; this(T init) { Typedef_payload = init; } mixin Proxy!Typedef_payload; } void main() { class C {} C c1 = new C(); auto a = Typedef!C(c1); C c2 = a; }
Comment #1 by k.hara.pg — 2012-03-03T22:22:09Z
Comment #2 by github-bugzilla — 2012-03-10T00:45:06Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/368d966cb0efd1b326d9ac6a5879f96864f92416 Merge pull request #780 from 9rnsr/fix7641 fix Issue 7641 - std.typecons.Proxy incorrectly allows implicit conversion to class
Comment #3 by k.hara.pg — 2012-03-27T17:40:04Z
Comment #4 by k.hara.pg — 2012-03-27T17:40:39Z
*** Issue 671 has been marked as a duplicate of this issue. ***