D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 258 - Undefined identifier error for circular import
Summary: Undefined identifier error for circular import
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2006-07-19 16:53 UTC by Stewart Gordon
Modified: 2014-02-15 13:18 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stewart Gordon 2006-07-19 16:53:07 UTC
----- core.d -----
public import application, windowbase;
----- application.d -----
import core;

WindowBase mainWindow() {
	return null;
}
----- windowbase.d -----
import core;

class WindowBase {}
----------
D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c core.d
application.d(3): identifier 'WindowBase' is not defined
application.d(3): WindowBase is used as a type

D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c windowbase.d
application.d(3): identifier 'WindowBase' is not defined
application.d(3): WindowBase is used as a type

D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c application.d
----------

It doesn't matter whether the imports in application.d and windowbase.d are private or public.  If the imports in core.d are swapped, all files compile without error.
Comment 1 Thomas Kühne 2006-09-14 07:15:37 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail@puremagic.com schrieb am 2006-07-19:
> http://d.puremagic.com/issues/show_bug.cgi?id=258

> ----- core.d -----
> public import application, windowbase;
> ----- application.d -----
> import core;
>
> WindowBase mainWindow() {
>         return null;
> }
> ----- windowbase.d -----
> import core;
>
> class WindowBase {}
> ----------
> D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c core.d
> application.d(3): identifier 'WindowBase' is not defined
> application.d(3): WindowBase is used as a type
>
> D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c windowbase.d
> application.d(3): identifier 'WindowBase' is not defined
> application.d(3): WindowBase is used as a type
>
> D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c application.d
> ----------
>
> It doesn't matter whether the imports in application.d and windowbase.d are
> private or public.  If the imports in core.d are swapped, all files compile
> without error.

Added to DStress as
http://dstress.kuehne.cn/compile/i/import_17_A.d
http://dstress.kuehne.cn/compile/i/import_17_B.d
http://dstress.kuehne.cn/compile/i/import_17_C.d
http://dstress.kuehne.cn/compile/i/import_17_D.d
http://dstress.kuehne.cn/compile/i/import_17_E.d
http://dstress.kuehne.cn/compile/i/import_17_F.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFCU1WLK5blCcjpWoRAhiWAJ9Q5A8u4BY03DDFEtStywdz0tgkHQCdHKaT
ONZSp+czsmiAQYtOdUqcEs0=
=wRYq
-----END PGP SIGNATURE-----

Comment 2 Rainer Schuetze 2009-09-18 00:43:41 UTC
The patch for issue 3301 also fixes this issue.
Comment 3 Walter Bright 2009-10-13 13:43:27 UTC
Fixed dmd 1.049 and 2.034