[Issue 11238] New: Codegen error when this is a ref parameter to the method
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 12 17:24:31 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11238
Summary: Codegen error when this is a ref parameter to the
method
Product: D
Version: D2
Platform: All
OS/Version: Windows
Status: NEW
Severity: regression
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: aliloko at gmail.com
--- Comment #0 from ponce <aliloko at gmail.com> 2013-10-12 17:24:30 PDT ---
When executing the program:
struct A
{
void f()
{
g(this);
}
void g(ref A res)
{
res.m = [m[1], m[0]]; // swap
}
int[2] m;
}
void main()
{
A a;
a.m[0] = 4;
a.m[1] = 6;
writefln("%s,%s", a.m[0], a.m[1]);
a.f();
writefln("%s,%s", a.m[0], a.m[1]);
a.f();
writefln("%s,%s", a.m[0], a.m[1]);
}
Output is:
4,6
6,6
6,6
But I'm expecting this, that DMD 2.062 does output:
4,6
6,4
4,6
DMD 2.063, DMD 2.063.2 and DMD 2.064 beta all have this bug.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list