Thread overview
[Issue 1746] New: Enums with member initializers generate undefined symbols
Dec 22, 2007
d-bugmail
Feb 25, 2008
d-bugmail
Mar 13, 2008
d-bugmail
Apr 19, 2008
d-bugmail
December 22, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1746

           Summary: Enums with member initializers generate undefined
                    symbols
           Product: DGCC aka GDC
           Version: 0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: link-failure
          Severity: critical
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn@users.sf.net
        ReportedBy: pseus7@gmail.com


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.


-- 

February 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1746





------- Comment #1 from thomas-dloop@kuehne.cn  2008-02-25 05:06 -------
Added to DStress as http://dstress.kuehne.cn/run/e/enum_52_A.d http://dstress.kuehne.cn/run/e/enum_52_B.d http://dstress.kuehne.cn/run/e/enum_52_C.d


-- 

March 13, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1746


svanleent@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |svanleent@gmail.com




------- Comment #2 from svanleent@gmail.com  2008-03-13 15:30 -------
Still happens on revision 199 (with debian etch, x86_64)


-- 

April 19, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1746


dvdfrdmn@users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #3 from dvdfrdmn@users.sf.net  2008-04-19 11:49 -------
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]; }

--


--