Bug 12650 – Invalid codegen on taking lvalue of instance field initializ
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-25T18:53:00Z
Last change time
2014-04-26T20:20:59Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
temtaime
Comments
Comment #0 by temtaime — 2014-04-25T18:53:38Z
import std.stdio;
struct S {
int a;
}
void foo(ref in S s) {}
class A {
this()(auto ref in S a) { foo(s = a); }
S s;
}
void main() {
new A(S(2)).s.writeln;
}
GIT HEAD output : 0
2.065 output : 2
Expected output : 2
Comment #1 by k.hara.pg — 2014-04-26T11:12:45Z
(In reply to Temtaime from comment #0)
> 2.065 output : 2
I think this is git-head only regression. Because the OP code cannot compile with 2.065:
$ dmd -run test
test.d(10): Error: function test.foo (ref const(S) s) is not callable using argument types (S)
test.d(16): Error: template instance test.A.__ctor!() error instantiating
(Assignment expression is changed to lvalue in git-head, by fixing issue 12211)
Sorry, test case is wrong.
void foo()(auto ref in S s) {}
s must be auto ref.
So it's 2.065 reg.
Comment #4 by k.hara.pg — 2014-04-26T12:30:56Z
(In reply to Temtaime from comment #3)
> Sorry, test case is wrong.
>
> void foo()(auto ref in S s) {}
>
> s must be auto ref.
>
> So it's 2.065 reg.
OK I understand, and the bug will be fixed by my PR.
Comment #5 by k.hara.pg — 2014-04-26T12:36:16Z
(In reply to Temtaime from comment #3)
> So it's 2.065 reg.
Note that, the test case has worked as intended with 2.065, but doesn't work with git-head. Right?
Therefore the 'regression' is introduced in git-head development. So we should call it git-head (only) regression.
Comment #6 by temtaime — 2014-04-26T12:38:36Z
Yes, i missed "after" word. :)
It's a git-head regression.
Offtop:
Thanks for your pr and contribution!
Comment #7 by github-bugzilla — 2014-04-26T20:20:59Z