digitalmars.D.bugs - [Issue 21353] New: 'With()' statement ignores symbol visibility in
- d-bugmail puremagic.com (41/41) Oct 31 2020 https://issues.dlang.org/show_bug.cgi?id=21353
https://issues.dlang.org/show_bug.cgi?id=21353 Issue ID: 21353 Summary: 'With()' statement ignores symbol visibility in some cases. Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: boris2.9 gmail.com Bug exposed while looking at issue 21351 imp.d ------------------ struct A { int x; } struct B { import imp : A; } // imports are private by default private struct P { } test.d ------------------ import imp; void main() { B.A; with (B) { A(0); } with (B()) { A(0); } imp.P(); with (imp) { P(); } } The above code fails with the following output: test.d(5): Error: no property A for type imp.B test.d(6): Error: no property A for type imp.B test.d(7): Error: cannot implicitly convert expression __withSym of type B* to int test.d(9): Error: undefined identifier P in module imp test.d(10): Error: P() has no effect Note that lines 7 and 10 should fail with same error as theirs respective forms without 'with' statement because the symbols A and P are private. --
Oct 31 2020