7817 – opAssign to in declaration broken in dmd 1.074 beta1

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7817 - opAssign to in declaration broken in dmd 1.074 beta1
Summary: opAssign to in declaration broken in dmd 1.074 beta1
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
Reported: 2012年04月03日 11:41 UTC by Jakob Bornecrantz
Modified: 2015年06月09日 05:13 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
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 によって変換されたページ (->オリジナル) /