[Issue 23273] New: [REG2.095] Error on passing inout variable to function (not an lvalue)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 29 22:36:24 UTC 2022
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 at puremagic.com
Reporter: johanengelen at 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.
--
More information about the Digitalmars-d-bugs
mailing list