Bug 13552 – Type deduction doesn't fall back to alias this if postblit is disabled

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-09-28T19:54:50Z
Last change time
2018-11-05T09:07:21Z
Assigned to
No Owner
Creator
Marc Schütz

Comments

Comment #0 by schuetzm — 2014-09-28T19:54:50Z
In the following code, the line with `i` compiles, but the line with `j` doesn't. It complains that "struct xx.S is not copyable because it is annotated with @disable". struct S { int x; @disable this(this); alias x this; } void main() { S s; int i = s; auto j = s; } I think it should compile and infer `j` to be `int`.
Comment #1 by razvan.nitu1305 — 2018-11-02T11:17:14Z
Comment #2 by bugzilla — 2018-11-04T21:42:27Z
patrickkh7788 commented on github: "I think it should not work like this. the Proxy type could be used with a pointer into a resource, with @disable this(this) to prevent the pointer copy from one to other. allow this could introduce unwanted memory pointer copy and result in a null pointer." He's got a point. This is an invalid bug.