Bug 7817 – opAssign to in declaration broken in dmd 1.074 beta1
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-03T11:41:00Z
Last change time
2015-06-09T05:13:46Z
Assigned to
nobody
Creator
wallbraker
Comments
Comment #0 by wallbraker — 2012-04-03T11:41:54Z
The following code works in dmd.1.073 but is broken in dmd.1.074.
struct Foo {}
struct Bar {
void opAssign(Foo f) {}
}
void test() {
Foo f;
Bar bar = f; // Broken in dmd 1.074-beta
Bar baz;
baz = f; // Works as expected.
}
Comment #1 by clugdbug — 2012-04-03T12:08:11Z
(In reply to comment #0)
> The following code works in dmd.1.073 but is broken in dmd.1.074.
>
> struct Foo {}
>
> struct Bar {
> void opAssign(Foo f) {}
> }
>
> void test() {
> Foo f;
> Bar bar = f; // Broken in dmd 1.074-bet
That isn't an assignment - it's an initialization.
I wonder why that worked before.
>
> Bar baz;
> baz = f; // Works as expected.
> }
Comment #2 by bugzilla — 2012-04-05T15:25:27Z
It is a bug that this ever worked. Assignment is not initialization. However, I will revert to the original behavior to avoid breaking existing code.
Comment #3 by github-bugzilla — 2012-04-05T15:45:13Z