Can't read a constant value in compile time?

Adnan contact.adnan.02 at protonmail.com
Tue Nov 20 18:57:18 UTC 2018


On Tuesday, 20 November 2018 at 18:54:58 UTC, Adnan wrote:
> Godbolt: https://godbolt.org/z/SWWOu7
>
> When I write `something!(aNumber)()` and if a number is an 
> immutable/enum it should be able to be read at compile time, 
> right? Why is this different?
>
> auto fizzbuzz(uint N)() {
>     static string accumulate;

Also note that removing this `static` seems to work, but produces 
a massive number of instructions even with -O5. What is the 
program doing?




More information about the Digitalmars-d-learn mailing list