d2: strange lowering of protection and possible misbehavior in static imports
Posted
by
modchan
on Stack Overflow
See other posts from Stack Overflow
or by modchan
Published on 2012-04-07T23:24:42Z
Indexed on
2012/04/07
23:29 UTC
Read the original article
Hit count: 320
Consider there is moda.d:
module moda;
private struct modb {};
And modb.d:
module modb;
private import moda;
And modmain.d:
module modmain;
static import moda;
static import modb;
void main() {
modb v; // should NOT compile, should it?
}
I don't know why, but moda.modb is visible in both modmain and modb, while, as far as I understand, it should not - both due to moda being imported as static and moda.modb being private. Or should? Have I run into dmd bug or it's planned behaviour I hadn't understood?
© Stack Overflow or respective owner