D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1676 - Undefined symbol at linking with circular import and enum
Summary: Undefined symbol at linking with circular import and enum
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: link-failure
Depends on:
Blocks:
 
Reported: 2007-11-16 18:42 UTC by Stewart Gordon
Modified: 2014-02-24 15:32 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stewart Gordon 2007-11-16 18:42:04 UTC
----- linkfail_a.d -----
import linkfail_b;

void main() {}

enum Qwert : byte { YUIOP, ASDFG }

struct Hjkl {
    Qwert zxcvb() {
        return Qwert.YUIOP;
    }
}
----- linkfail_b.d -----
import linkfail_a;

void nm() {
    try {
        qaz(Hjkl.init.zxcvb);
    } catch (Object e) {}
}

void qaz(Qwert wsx) {}

const int[] edc = [ Qwert.YUIOP: 42, 105 ];
----------

Fails:
dmd -c linkfail_a.d
dmd -c linkfail_b.d
dmd linkfail_a.obj linkfail_b.obj

Fails:
dmd -c linkfail_b.d
dmd linkfail_a.d linkfail_b.obj

Works:
dmd linkfail_a.d linkfail_b.d

Both failure cases give the same error:
----------
d:\dmd\bin\..\..\dm\bin\link.exe linkfail_a+linkfail_b,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

linkfail_b.obj(linkfail_b)
 Error 42: Symbol Undefined _D10linkfail_a4Hjkl5zxcvbMFZE10linkfail_a5Qwert
--- errorlevel 1
----------

This bites the date/time code in my utility library.  At least, I *think* this is a regression....
Comment 1 Don 2009-09-15 01:43:39 UTC
I can confirm that this was failing in 1.023, but had been working in 1.020.
It now works in both D1 and D2. Was fixed somewhere between 1.024 and 1.036 (works in 1.036).