mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
fix Issue 14203 - Return of floating point values from extern(C++) member functions does not match dmc
This commit is contained in:
parent
f0e381ba75
commit
bfbe97811b
3 changed files with 34 additions and 0 deletions
|
@ -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);
|
||||
|
|
2
test/runnable_cxx/extra-files/c14203.cpp
Normal file
2
test/runnable_cxx/extra-files/c14203.cpp
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
float func1() { return 73; }
|
22
test/runnable_cxx/test14203.d
Normal file
22
test/runnable_cxx/test14203.d
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue