<div>Hi</div><div><br></div><div>When compiling following code with dmd (v2.051)</div><div><br></div><div>enum nums { X = 'a', Y, Z }</div><div><br></div><div>void main() {</div><div> nums q;</div><div> char w;</div>
<div> w = q;</div><div>}</div><div><br></div><div>I get 'Error: cannot implicitly convert expression (q) of type nums to char' for the 'w = q' assigment.</div><div><br></div><div>Should'n the inferred base type for 'nums' be char, given that the first 'nums' member is initilized with char literal 'a'?</div>
<div><br></div><div>When the nums declaration is changed to:</div><div><br></div><div>enum nums : char { X = 'a', Y, Z }</div><div><br></div><div>the code compiles without errors.</div><div><br></div><div>It seems that when enums base type is allways inferred to int. Am I missing something or is it an DMD bug?</div>
<div><br></div><div>/lennart</div>