Bug 7132 – [tdpl] Exponential operator ^^ for integrals does not compile without any import
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-12-18T18:13:00Z
Last change time
2014-01-06T12:53:12Z
Keywords
TDPL
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2011-12-18T18:13:15Z
//import std.stdio;
void main() {
uint base;
uint exp;
static assert(is(typeof(base ^^ exp) == uint));
}
test.d(8): Error: static assert (is(typeof(__error) == uint)) is false
If the import is uncommented, the code compiles.
Comment #1 by clugdbug — 2011-12-24T04:52:18Z
That's because ^^ requires import std.math;
To make it work without the import, we need to move the intpow function out of std.math, and into the runtime.
That's quite reasonable, provided we don't have to do the same for floating point powers.
(To implement floating point powers, most of std.math would need to move to the runtime. In fact to do it with correct rounding, parts of bigint would be required as well).
Comment #2 by andrej.mitrovich — 2014-01-06T12:53:12Z