[Issue 13142] New: Enums on different classes confuse the compiler

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 16 16:56:52 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13142

          Issue ID: 13142
           Summary: Enums on different classes confuse the compiler
           Product: D
           Version: unspecified
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: mingodad at gmail.com

Trying to compile Harmonia with dmd 2.065 I discovered a bug that was not
present on previous versions.
Sample program to show the bug:
------
class Button {
  enum TYPE // button type
  {
    COMMAND,
    CHECK,
    OPTION,
  }
}

class Toolbar {
  enum ButtonTYPE // button type
  {
    COMMAND   = Button.TYPE.COMMAND,
    CHECK     = Button.TYPE.CHECK,
    OPTION    = Button.TYPE.OPTION,
    DELIMETER = Button.TYPE.max + 1
  }
}

void main(){}
------
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.

--


More information about the Digitalmars-d-bugs mailing list