fix Issue 14203 - Return of floating point values from extern(C++) member functions does not match dmc

This commit is contained in:
Walter Bright 2020-09-02 22:46:54 -07:00 committed by The Dlang Bot
parent f0e381ba75
commit bfbe97811b
3 changed files with 34 additions and 0 deletions

View file

@ -715,6 +715,16 @@ extern (C++) struct Target
else
return true;
}
else if (global.params.isWindows &&
!global.params.is64bit &&
(tf.linkage == LINK.cpp || tf.linkage == LINK.pascal) &&
tf.isfloating())
{
/* See DMC++ function exp2_retmethod()
* https://github.com/DigitalMars/Compiler/blob/master/dm/src/dmc/dexp2.d#L149
*/
return true;
}
else
{
//assert(sz <= 16);

View file

@ -0,0 +1,2 @@
float func1() { return 73; }

View file

@ -0,0 +1,22 @@
// EXTRA_CPP_SOURCES: c14203.cpp
/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=14203
extern (C++) float func1();
void test14203()
{
assert(func1() == 73);
}
/************************************************/
int main()
{
test14203();
return 0;
}