Comment #0 by bearophile_hugs — 2011-05-26T05:04:59Z
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.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test)
Error 42: Symbol Undefined _Dmain3Foo6__initZ
Comment #1 by andrej.mitrovich — 2012-12-19T04:12:06Z