D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4102 - 'object' name in module declaration
Summary: 'object' name in module declaration
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2010-04-17 17:31 UTC by Masahiro Nakagawa
Modified: 2015-06-09 05:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Masahiro Nakagawa 2010-04-17 17:31:36 UTC
Now, I am writing serialization library for Phobos(repository is located bitbucket http://bitbucket.org/repeatedly/msgpack4d ). I create msgpack.object module but compilation error occurs. The module that contains 'object' can't use some classes defined in default object module. Following code is example:

-----
module foo.object;

class FooException : Exception { this(string msg) { super(msg); } }
-----

% dmd main.d foo/object.d
foo/object.d(3): Error: identifier 'Exception' is not defined
foo/object.d(3): Error: Exception is used as a type
foo/object.d(3): Error: class foo.object.FooException base type must be class or interface, not void
foo/object.d(3): Error: identifier 'Object' is not defined
foo/object.d(3): Error: Object is used as a type
Assertion failed: (b->type->ty == Tclass), function semantic, file class.c, line 454.

foo.object hides default object module. Is this a bug or doesn't module declaration contain 'object'?

To avoid this problem uses 'import object;' in foo.objcet.
Comment 1 Infiltrator 2014-03-18 22:44:53 UTC
The provided code works as of 2.065.