www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19219] New: Could not CEFE with std.math.exp from 2.082.0

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

          Issue ID: 19219
           Summary: Could not CEFE with std.math.exp from 2.082.0
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: shigekikarita gmail.com

I found changes in std.math make std.math.exp for CTFE not working anymore

https://dlang.org/changelog/2.082.0.html#math_float_double_implementations

// working in 2.081.2, not 2.082.0
import std.math;

void main() {
    // functions changed in std.math 2.082.0
    enum a0 = atan(1.0);   // could not CTFE as before
    enum a1 = atan2(1.0);  // could not CTFE as before
    enum a2 = tan(1.0);
    enum a3 = exp(1.0);    // could not CTFE in 2.082.0 newly
    enum a4 = expm1(1.0);
    enum a5 = exp2(1.0);
}


// std.math.exp error in 2.082.0
rdmd ./test.d
/home/skarita/dlang/dmd-2.082.0/linux/bin64/../../src/phobos/std/math.d(2360):
Error: static variable P cannot be read at compile time
/home/skarita/dlang/dmd-2.082.0/linux/bin64/../../src/phobos/std/math.d(2360): 
      called from here: poly(xx, P)
/home/skarita/dlang/dmd-2.082.0/linux/bin64/../../src/phobos/std/math.d(2221): 
      called from here: expImpl(x)
/home/skarita/dlang/dmd-2.082.0/linux/bin64/../../src/phobos/std/math.d(2225): 
      called from here: exp(cast(real)x)
./test.d(4):        called from here: exp(-1)
Failed: ["/home/skarita/dlang/dmd-2.082.0/linux/bin64/dmd", "-v", "-o-",
"./test.d", "-I."]

--
Sep 04 2018