Bug 12644 – Some std.math functions are not yet @nogc
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-04-25T11:18:00Z
Last change time
2014-05-06T21:01:56Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2014-04-25T11:18:30Z
void main() @nogc {
import std.math: floor, ceil, round, asin, atan2;
auto x = floor(2.2);
auto y = ceil(2.2);
auto z = round(2.2);
auto r1 = asin(1.0);
auto r2 = atan2(1.0, 1.0);
}
DMD 2.066alpha gives:
test.d(3,19): Error: @nogc function 'D main' cannot call non-@nogc function 'std.math.floor'
test.d(4,18): Error: @nogc function 'D main' cannot call non-@nogc function 'std.math.ceil'
test.d(5,19): Error: @nogc function 'D main' cannot call non-@nogc function 'std.math.round'
test.d(6,19): Error: @nogc function 'D main' cannot call non-@nogc function 'std.math.asin'
test.d(7,20): Error: @nogc function 'D main' cannot call non-@nogc function 'std.math.atan2'
Comment #1 by bearophile_hugs — 2014-04-27T10:42:18Z
Also:
void main() @nogc {
import std.math: log, acos;
auto x1 = log(2.2);
auto x2 = acos(0.0);
}
Comment #2 by bearophile_hugs — 2014-05-06T21:01:56Z