Showing with 9 additions and 15 deletions.
  1. +2 −2 src/toir.c
  2. +7 −13 test/runnable/cabi1.d
4 changes: 2 additions & 2 deletions src/toir.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ RET retStyle(TypeFunction *tf)

if (global.params.isWindows && global.params.is64bit)
{
// http://msdn.microsoft.com/en-us/library/7572ztz4(v=vs.80)
// http://msdn.microsoft.com/en-us/library/7572ztz4.aspx
if (tns->ty == Tcomplex32)
return RETstack;
if (tns->isscalar())
Expand All @@ -866,7 +866,7 @@ RET retStyle(TypeFunction *tf)
StructDeclaration *sd = ((TypeStruct *)tns)->sym;
if (sd->ident == Id::__c_long_double)
return RETregs;
if (!sd->isPOD() || sz >= 8)
if (!sd->isPOD() || sz > 8)
return RETstack;
if (sd->fields.dim == 0)
return RETstack;
Expand Down
20 changes: 7 additions & 13 deletions test/runnable/cabi1.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ extern (C) Foo5 ctest5();
extern (C) Foo6 ctest6();
extern (C) S7 ctest10();

version(Windows)
version = Windows_or_32bit;
else version(X86)
version = Windows_or_32bit;


void test1()
{
Foo1 f1 = ctest1();
Expand All @@ -34,34 +40,22 @@ void test1()
Foo4 f4 = ctest4();
assert(f4.i == 0x12345678);

version (Win64)
{
}
else
{
Foo5 f5 = ctest5();
assert(f5.i == 0x12345678);
assert(f5.j == 0x21436587);
}

version (X86)
version(Windows_or_32bit)
{
Foo6 f6 = ctest6();
assert(f6.i == 0x12345678);
assert(f6.j == 0x21463587);
assert(f6.k == 0x24163857);
}

version (Win64)
{
}
else
{
S7 s7 = ctest10();
assert(s7.a == 2.5);
assert(s7.b == 1.5);
}
}

/*******************************************/

Expand Down