[Issue 9881] New: Indirect cyclic imports are not forbidden
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 5 03:40:03 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9881
Summary: Indirect cyclic imports are not forbidden
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: druntime
AssignedTo: nobody at puremagic.com
ReportedBy: thecybershadow at gmail.com
--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2013-04-05 13:40:00 EEST ---
Consider a program with three files:
=== A.d ===
import B, C;
void main() {}
=== B.d ===
import A;
shared static this() {}
=== C.d ===
import A;
shared static this() {}
Illustrated:
+---+ +---+ +---+
| | ---> | | ---> | |
| B | | A | | C |
| | <--- | | <--- | |
+---+ +---+ +---+
B and C have static constructors.
This program is allowed to compile and run, even though there is a circular
dependency between B and C. In a practical case, it can result in a problem
when B accesses something initialized in C via something in A.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list