D issues are now
tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Summary: |
opAssign to in declaration broken in dmd 1.074 beta1 |
Product: |
D
|
Reporter: |
Jakob Bornecrantz <wallbraker> |
Component: |
dmd | Assignee: |
No Owner <nobody> |
Status: |
RESOLVED
FIXED
|
Severity: |
regression
|
CC: |
bugzilla, clugdbug
|
Priority: |
P2
|
Version: |
D2 |
Hardware: |
All |
OS: |
All |
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.
}
(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
Walter Bright
2012年04月05日 15:25:27 UTC
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.