d2: strange lowering of protection and possible misbehavior in static imports
- by modchan
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?