Static array as immutable

Ivan Trombley itrombley at dot-borg.org
Tue Dec 12 18:06:48 UTC 2017


On Tuesday, 12 December 2017 at 15:30:01 UTC, Nathan S. wrote:
> While what you're saying is true, exponentiation not being 
> runnable at compile-time is a defect and I would assume a 
> regression. I'll file a bug report. FWIW when trying to run the 
> following with DMD v2.077.1 I get:
>
> ```
> void main(string[] args)
> {
>     import std.stdio;
>     enum e = (1.0 / 255.0f) ^^ (1 / 2.2f);
>     writeln("e = ", e);
> }
> ```
>
> =>
>
> [...]/dmd/std/math.d(440): Error: y.vu[4] is used before 
> initialized
> [...]/dmd/std/math.d(413):        originally uninitialized here
> [...]/dmd/std/math.d(4107):        called from here: 
> floorImpl(x)
> [...]/dmd/std/math.d(2373):        called from here: floor(x + 
> 0.5L)
> [...]/dmd/std/math.d(2110):        called from here: exp2Impl(x)
> [...]/dmd/std/math.d(6743):        called from here: 
> exp2(yl2x(x, y))
> [...]/dmd/std/math.d(6756):        called from here: 
> impl(cast(real)x, cast(real)y)

FWIW, if the exponent is an integer, I don't get an error.


More information about the Digitalmars-d-learn mailing list