enum Enums { a, b } void main() { enum Fields = [ Enums.a : "a", ]; mixin("auto x = " ~ Fields[Enums.b] ~ ";"); } Errors: test.d(16): Error: argument to mixin must be a string, not ("auto x = " ~ [cast(Enums)0:"a"][cast(Enums)1] ~ ";") test.d(16): Error: argument to mixin must be a string, not ("auto x = " ~ [cast(Enums)0:"a"][cast(Enums)1] ~ ";") I'd rather the errors be something like: test.d(16): Error: CTFE: Key 'Enums.b' is not in 'Fields' test.d(16): Error: argument to mixin must be a string, not ("auto x = " ~ (__error) ~ ";") We could also get rid of duplicate error messages.
DMD v2.065 DEBUG testx.d(14): Error: key cast(Enums)1 not found in associative array [cast(Enums)0:"a"]