[Issue 6057] New: Problem with defining enum in function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 26 05:09:19 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6057
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
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 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.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test)
Error 42: Symbol Undefined _Dmain3Foo6__initZ
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list