[Issue 1746] New: Enums with member initializers generate undefined symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 22 08:07:28 PST 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 at users.sf.net
        ReportedBy: pseus7 at 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.


-- 



More information about the D.gnu mailing list