Bug 580 – Inconsistent constant->enum conversion rules

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-11-20T15:14:00Z
Last change time
2014-02-15T13:19:42Z
Assigned to
bugzilla
Creator
sean

Comments

Comment #0 by sean — 2006-11-20T15:14:31Z
Compiling the code: enum A : uint { a = 0, b = 1 } enum B : ulong { a = 0, b = 1 } void main() { A a = 1; B b = 1; } Gives: test.d(16): Error: cannot implicitly convert expression (1) of type int to B Changing the second constant to 1UL has the same result. This is inconsistent. Either both assignments should work or neither should.
Comment #1 by bugzilla — 2008-06-30T01:14:58Z
In dmd 1.031 and 2.015, both produce a compile error as expected.