Like I said it doesn't compile because it can't do CTFE. But remove static in front of the second assert and it compiles (and works also during runtime): assert(ValueUser.getValue() == 42);