https://issues.dlang.org/show_bug.cgi?id=13142
Kenji Hara <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Hardware|x86_64 |All Version|unspecified |D2 OS|Linux |All Severity|regression |normal --- Comment #1 from Kenji Hara <[email protected]> --- (In reply to Domingo Alvarez Duarte from comment #0) > dmd 2.065 : bugEnum.d(4): Error: cannot implicitly convert expression (3) of > type int to TYPE > LDC - the LLVM D compiler (0.13.0) based on DMD 2.064: The same error. > gdc 4.9: The same error. > gdc 4.8.1 : Compiles without error. In 2.064, some incorrect type coercing around enum declaration has been fixed. By that, the error reporting is an expected result from 2.064, and it's not a regression issue. At line 16 in the sample code: DELIMETER = Button.TYPE.max + 1 The type of Button.TYPE.max is Button.TYPE, but the addition result is typed int. In this code, base type of Toolbar.ButtonTYPE is deduced to Button.TYPE, and int is not implicitly convert to it. So the line should be changed to: DELIMETER = cast(Button.TYPE)Button.TYPE.max + 1 or specify the base type of ButtonTYPE as int explicitly: enum ButtonTYPE : int // <-- { COMMAND = Button.TYPE.COMMAND, CHECK = Button.TYPE.CHECK, OPTION = Button.TYPE.OPTION, DELIMETER = Button.TYPE.max + 1 // OK } Although, as I explained, the true bug is in line 16. Therefore the diagnostic message should be fixed to: bugEnum.d(16): Error: cannot implicitly convert expression (3) of type int to TYPE --
