90 – local object.d overrides real object.d causing crash

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 90 - local object.d overrides real object.d causing crash
Summary: local object.d overrides real object.d causing crash
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P3 minor
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2006年04月06日 19:20 UTC by Regan Heath
Modified: 2014年02月15日 02:08 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Regan Heath 2006年04月06日 19:20:45 UTC
[object.d] (an empty file)
[bug.d]
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.
Comment 1 Thomas Kühne 2006年04月08日 14:25:18 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail@puremagic.com schrieb am 2006年04月07日:
> http://d.puremagic.com/bugzilla/show_bug.cgi?id=90
> [object.d] (an empty file)
>
> [bug.d]
> 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.
Added to DStress as
http://dstress.kuehne.cn/complex/object_02
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFEOBqr3w+/yD4P9tIRAhsGAKCTMWrTuMpR4Ru6JDycxDApPkNBXwCgksBU
LAySEK8qdbU5jKnJDhhpBA4=
=B0Nt
-----END PGP SIGNATURE-----
Comment 2 Walter Bright 2006年04月11日 01:33:52 UTC
Fixed 0.153


AltStyle によって変換されたページ (->オリジナル) /