Consider the following code ( https://run.dlang.io/is/mn75WZ ): --- a.d module a; private struct S { Alias member; } private alias Alias = int; --- b.d module b; import a; void main() { Alias var; } -- Clearly this shouldn't ought to compile, but it does. Alias is publically visible as an export from a, despite being declared private. This only seems to happen if S comes before Alias. Somehow, using the symbol early prevents it from being marked private.
dlang/dmd pull request #11356 "Fix issue 21001: alias protection is ignored if used before declaration." was merged into master: - 7a3a2e3af7810c812d691d941bfe3ae892f678cd by Mathis Beer: Fix issue 21001: alias protection is ignored if used before declaration. https://github.com/dlang/dmd/pull/11356
dlang/dmd pull request #11831 "[dmd-cxx] fix Issue 21295: Add test for symbol lookup/resolve in compilation broken" was merged into dmd-cxx: - 828a643338cf8834608227ea815d94acccdd2b77 by Mathis Beer: [dmd-cxx] Fix issue 21001: alias protection is ignored if used before declaration. https://github.com/dlang/dmd/pull/11831