D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7856 - static import-ed module behaves as symbol it contents
Summary: static import-ed module behaves as symbol it contents
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-08 04:16 UTC by Alex
Modified: 2017-06-26 00:52 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 Alex 2012-04-08 04:16:55 UTC
In case there is symbol in module that has the same name as module itself, it will be substituted for module when doing static import regardless of protection level.

Example:

=== mod.d:
    module mod;
    
    private {
        version(foo) union mod {};
        version(bar) struct mod {};
        version(baz) class mod {};
        version(quux) alias int mod;
    }

=== modmain.d:
    module modmain;
    
    import std.stdio;
    static import mod;
    
    void main() {
        writeln(typeid(mod));
    }
Comment 1 Vladimir Panteleev 2017-06-26 00:52:43 UTC
With the provided example, all I get is:

modmain.d(7): Error: no type for typeid(mod)

even with the DMD versions released at the time this bug was filed.

Please reopen if you can provide a working example.