Bug 1746 – Enums with member initializers generate undefined symbols

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-12-22T10:07:00Z
Last change time
2015-06-09T05:14:50Z
Keywords
link-failure
Assigned to
dvdfrdmn
Creator
pseus7

Comments

Comment #0 by pseus7 — 2007-12-22T10:07:27Z
Steps to reproduce: ----- bug.d ----- module bug; enum GDCBUG { BUG = -1, ISSUE = -2, PROBLEM = -3 } ----------------- Compile with: gdmd -S bug.d Test with: cat bug.s | grep __s Output: .long ___s.898 .local ___s.898 .comm ___s.898,0,1 ======================== WORKAROUND: ----- bug.d ----- module bug; enum GDCBUG { GDC_WORKAROUND, //If the first member has no default value (or that value is 0), no undefined symbols are produced. BUG = -1, ISSUE = -2, PROBLEM = -3 } ----------------- Compile with: gdmd -S bug.d Test with: cat bug.s | grep __s Output: (empty) ======================== First experienced by the Tango guys: http://dsource.org/projects/tango/ticket/450 Now causing lots of problems for the gtkD guys: http://www.dsource.org/projects/gtkd/ticket/4 This still happens in gdc-0.25-4.1.2-17 from Debian Lenny.
Comment #1 by thomas-dloop — 2008-02-25T05:06:39Z
Comment #2 by svanleent — 2008-03-13T15:30:29Z
Still happens on revision 199 (with debian etch, x86_64)
Comment #3 by dvdfrdmn — 2008-04-19T11:49:33Z
Fixed in release 0.25 / svn 213. Not sure if the description or the DStress cases actually test the problem(?) Need to have two modules: -- a.d -- enum E { A = 1, B = 2 } -- b.d -- import a; void main() { new E[10]; } --