Bug 861 – Using two typedefs of an undefined name in a class in a different module with import cycles causes DMD to hang
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-01-20T14:38:00Z
Last change time
2014-02-15T13:13:09Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla
Comments
Comment #0 by matti.niemenmaa+dbugzilla — 2007-01-20T14:38:47Z
Like Issue 860, this bug is hard to summarize. Essentially, the problem is that compiling the definesType module, below, causes DMD to hang with 100% CPU usage.
--
module definesType;
import usesType; // import cycle
//alias int NONEXISTENT_NAME;
//typedef int NONEXISTENT_NAME;
typedef NONEXISTENT_NAME
myTypedef,
myTypedef2;
--
module usesType;
import definesType;
// must be class, not struct or template
class UsesTypedefs {
// can be anything as long as both typedefs are used
myTypedef usesTypedef;
myTypedef2 usesTypedef2;
}
--
Uncommenting either the alias or the typedef (or even both) doesn't affect the bug in any way (this may have something to do with Issue 860).
Comment #1 by bugzilla — 2007-01-31T15:00:07Z
Works in DMD 1.004.
Comment #2 by matti.niemenmaa+dbugzilla — 2007-02-01T12:12:28Z
Still fails for me with 1.004. "dmd -c definesType.d" leads to a DMD hang.
Any idea of what could be causing it? With -v, dmd outputs the following before hanging:
parse definesType
semantic definesType
import object
import usesType
Comment #3 by bugzilla — 2007-02-01T13:07:00Z
It doesn't hang when I try it. It works fine. Are you *sure* you're using 1.004?
Comment #4 by digitalmars-com — 2007-02-01T17:17:31Z
I can confirm that definesType.d hangs DMD 1.004
C:\>dmd -c definesType.d
(Killed dmd.exe)
C:\>dmd
Digital Mars D Compiler v1.004
Copyright (c) 1999-2007 by Digital Mars written by Walter Bright
Documentation: www.digitalmars.com/d/index.html
(removed for brevity)