digitalmars.D.bugs - [Issue 23273] New: [REG2.095] Error on passing inout variable to
- d-bugmail puremagic.com (43/43) Jul 29 2022 https://issues.dlang.org/show_bug.cgi?id=23273
https://issues.dlang.org/show_bug.cgi?id=23273 Issue ID: 23273 Summary: [REG2.095] Error on passing inout variable to function (not an lvalue) Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: johanengelen weka.io Testcase: ``` struct Bug(V) { struct Cell { } void getCell(ref inout(Cell) *) inout { } void locate() inout { inout(Cell) * cell; getCell(cell); } } struct StructAlias(alias toRef) {} struct S(T) { void foo() {} alias RangesList = StructAlias!(foo); Bug!(RangesList) bins; } S!uint a; ``` Compiling with dlang2.094 succeeds Compiling with dlang2.095 gives the error: ``` bug.d(8): Error: `cast(inout(Cell)*)cell` is not an lvalue and cannot be modified bug.d(17): Error: template instance `bug.Bug!(StructAlias!(foo))` error instantiating bug.d(20): instantiated from here: `S!uint` ``` A workaround to have this code compile with dlang2.100 would be appreciated. --
Jul 29 2022