Sorry, I forgot to put some compiler output: For the declaration: uint[string] mywords = [ "Hello" : 1, "World" : 1, "Cat" : 1, "Dog" : 1 ]; I get: $ dmd test_01.d test_01.d(3): Error: non-constant expression ["Hello":1u,"World":1u,"Cat":1u,"Dog":1u]