[Issue 8870] New: Incorrect values passing struct by value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 22 12:39:59 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8870
Summary: Incorrect values passing struct by value
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: turkeyman at gmail.com
--- Comment #0 from Manu <turkeyman at gmail.com> 2012-10-22 12:39:58 PDT ---
http://dpaste.dzfl.pl/82f04399
t2 is [5, 6, 5, 6] when compiled with DMD-x64. should be [5, 6, 7, 8].
extern (C) fixes the problem.
----------------------------------------------------
import std.stdio;
struct Test
{
float x = 0;
float y = 0;
float z = 0;
float w = 0;
}
void main()
{
Test r1 = Test(1,2,3,4);
Test r2 = Test(5,6,7,8);
test(r1, r2, false, 1);
}
void test(Test t1, Test t2, bool someBool, float finalFloat)
{
// at this point, t2 == { 5, 6, 5, 6 }
writeln(t2);
}
--
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