Impure static

2011-11-09 Thread bearophile
This little D2 program, a pure function contains static variables initialized with calls to not pure functions: int foo() { return 1; } pure int bar() { enum int x1 = foo(); static immutable int x2 = foo(); return x1; } void main() {} The latest DMD gives: test.d(5): Error:

Re: Impure static

2011-11-09 Thread Timon Gehr
On 11/09/2011 02:16 PM, bearophile wrote: This little D2 program, a pure function contains static variables initialized with calls to not pure functions: int foo() { return 1; } pure int bar() { enum int x1 = foo(); static immutable int x2 = foo(); return x1; } void main()