[Bug 90] New: local object.d overrides real object.d causing crash

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 6 17:20:47 PDT 2006


           Summary: local object.d overrides real object.d causing crash
           Product: D
           Version: 0.151
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: regan at netwin.co.nz

[object.d] (an empty file)

class A {}
void main() {}

C:\>dmd bug.d
bug.d(1): identifier 'Object' is not defined
bug.d(1): Object is used as a type
Assertion failure: 'b->type->ty == Tclass' on line 286 in file 'class.c'

abnormal program termination

The presence of an object.d file in the local directory overrides the real and
required object.d in the dmd directory. This results in weird errors and a
compiler crash.

FYI: Removing the class declaration from bug.d avoids the issue.

Suggestions (one or more of these would be nice):
1- Refuse to compile reserved file names.
2- Rename the reserved files to something less likely to collide.
3- Ignore reserved files (and .obj files for them) in any directory but the
expected dmd directory.

Obviously doing #2 only, will only partially solve the problem (there remains a
chance it will occur in the future), but, it does make the complete solution,
involving #1 or #3, less likely to be a problem when a collision does occur.


More information about the Digitalmars-d-bugs mailing list