[Issue 21721] New: error casting std.BigInts to built-in floating point types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 15 19:34:54 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21721

          Issue ID: 21721
           Summary: error casting std.BigInts to built-in floating point
                    types
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: jwood13578 at gmail.com

Reproducible here by going to

https://dlang.org/phobos/std_bigint.html#.BigInt.opCast

under the

const nothrow @nogc @safe T opCast(T)()
if (isFloatingPoint!T);

example entitled "Rounding when casting to floating point" and clicking Run.

This yields the following error:

Compilation output (1: )
/dlang/dmd/linux/bin64/../../src/phobos/std/bigint.d(991): Error: cannot take
address of local `resultBits` in `@safe` function `toFloat`
/dlang/dmd/linux/bin64/../../src/phobos/std/bigint.d(881): Error: template
instance `std.bigint.BigInt.toFloat!(double, "nearest")` error instantiating
onlineapp.d(41):        instantiated from here: `opCast!double`

--


More information about the Digitalmars-d-bugs mailing list