July 01, 2020
https://issues.dlang.org/show_bug.cgi?id=21001

          Issue ID: 21001
           Summary: Private alias becomes public if used before
                    declaration
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: default_357-line@yahoo.de

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.

--