[Issue 21351] When struct A is imported inside struct B, with(B) gets passed to A() constructor.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 31 12:11:23 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21351
Boris Carvajal <boris2.9 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |boris2.9 at gmail.com
--- Comment #1 from Boris Carvajal <boris2.9 at gmail.com> ---
This code should error about 'A' not being found in 'B' because imports are
private by default.
For example:
void main() { B().A(0); } // prints: 'Error: no property A for type b.B'
or using a type instead of a symbol in 'with' statement:
void main() { with (B) A(0); } // same error
You can make it work by changing:
struct B { import a : A; }
to:
struct B { public import a : A; }
I will try to fix the error but I'm not sure whether to change the bug subject
or file a new one.
--
More information about the Digitalmars-d-bugs
mailing list