Bug 19219 – Could not CTFE with std.math.exp from 2.082.0
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-09-04T12:07:26Z
Last change time
2018-09-10T15:05:03Z
Assigned to
No Owner
Creator
karita
Comments
Comment #0 by shigekikarita — 2018-09-04T12:07:26Z
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."]