D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4306 - std.numeric.CustomFloat doesn't work on Mac OS X.
Summary: std.numeric.CustomFloat doesn't work on Mac OS X.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-13 14:01 UTC by Masahiro Nakagawa
Modified: 2010-06-17 18:09 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Masahiro Nakagawa 2010-06-13 14:01:40 UTC
I tested following code using dmd 2.047 on Mac OS X 10.6.3.

-----
import std.numeric;

void main()
{
    CustomFloat!16 a;
}
-----

compilation result:

std/numeric.d(476): Error: template instance ToBinary!(real) does not match template declaration ToBinary(F) if (is(CustomFloat!(F.sizeof * 8)))
std/numeric.d(476): Error: ToBinary!(real) is used as a type
std/numeric.d(476): Error: variable std.numeric.CustomFloat!(precision,exponentWidth,flags,15).CustomFloat.get!(real).get.result voids have no value

I think this cause is real type size. real.sizeof is 16 on Mac OS X, but current std.numeric.CustomFloat can't treat those environments.
Comment 1 David Simcha 2010-06-13 16:35:44 UTC
This code was initially only tested on Windows, which doesn't use this padding.  Linux also uses padding, though to 12 bytes instead of 16.  I've checked in a fix that works on Linux.  It should work for Mac, too but I can't test it because I don't own a Mac.  Please let me know whether it does.
Comment 2 Masahiro Nakagawa 2010-06-15 16:24:11 UTC
Thanks for the fix.
I tested modified #0 code using trunk, No problem!