www.digitalmars.com         C & C++   DMDScript  

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


          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


// 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
Error: static variable P cannot be read at compile time
      called from here: poly(xx, P)
      called from here: expImpl(x)
      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