[Issue 21351] New: 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
Fri Oct 30 13:09:32 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21351
Issue ID: 21351
Summary: When struct A is imported inside struct B, with(B)
gets passed to A() constructor.
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
Consider these three files:
--- a.d
struct A { int value; }
--- b.d
struct B { import a : A; }
--- test.d
void main() { with (B()) A(0); }
DMD will say:
test.d(5): Error: cannot implicitly convert expression __withSym of type B* to
int
Despite B() not being necessary or allowed for A().
--
More information about the Digitalmars-d-bugs
mailing list