Summary: Problem with defining enum in function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-05-26 05:04:59 PDT ---
This program compiles and runs with no errors:

enum Foo { A=1, B=2 }
void main() {
    Foo[] bar = [cast(Foo)1, cast(Foo)2];

But moving the enum definition inside the main():

void main() {
    enum Foo { A=1, B=2 }
    Foo[] bar = [cast(Foo)1, cast(Foo)2];

Compiling with DMD 2.053 it gives:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
 Error 42: Symbol Undefined _Dmain3Foo6__initZ

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to