[Issue 2444] structs should allow calling the normal blitting function when overriding opAssign
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jul 3 15:44:51 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=2444
Mathias Lang <mathias.lang at sociomantic.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |mathias.lang at sociomantic.co
| |m
Resolution|--- |WORKSFORME
--- Comment #2 from Mathias Lang <mathias.lang at sociomantic.com> ---
So, IIUC, your test case would be:
```
struct Foo
{
int a;
~this () {}
void opAssign (int i) { }
}
void main ()
{
Foo f;
f = 42;
assert(f.a == 0);
f = Foo(45);
assert(f.a == 45);
}
```
This currently compiles & works as expected. Nowadays the compiler always
generate the required `opAssign` (which is the identity opAssign). Closing as
'worksforme'.
--
More information about the Digitalmars-d-bugs
mailing list