D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.

Issue 7817

Summary: opAssign to in declaration broken in dmd 1.074 beta1
Product: D Reporter: Jakob Bornecrantz <wallbraker>
Component: dmdAssignee: No Owner <nobody>
Status: RESOLVED FIXED
Severity: regression CC: bugzilla, clugdbug
Priority: P2
Version: D2
Hardware: All
OS: All

Description Jakob Bornecrantz 2012年04月03日 11:41:54 UTC
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 Don 2012年04月03日 12:08:11 UTC
(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.
Comment 3 github-bugzilla 2012年04月05日 15:45:13 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/96f497a2056cf7d511f4d9f29233ff256eaed1f5
fix Issue 7817 - opAssign to in declaration broken in dmd 1.074 beta1

AltStyle によって変換されたページ (->オリジナル) /