Re: Can't read a constant value in compile time?

2018-11-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/20/18 1:54 PM, 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; string is

Re: Can't read a constant value in compile time?

2018-11-20 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 20, 2018 at 06:54:58PM +, Adnan via Digitalmars-d-learn 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? [...] Read this

Re: Can't read a constant value in compile time?

2018-11-20 Thread Adnan via Digitalmars-d-learn
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

Can't read a constant value in compile time?

2018-11-20 Thread Adnan via Digitalmars-d-learn
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; return fizzbuzz!N(accumulate); } auto