www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23273] New: [REG2.095] Error on passing inout variable to


          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

struct Bug(V) {
  struct Cell { }

  void getCell(ref inout(Cell) *) inout {  }

  void locate() inout {
    inout(Cell) * 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
bug.d(17): Error: template instance `bug.Bug!(StructAlias!(foo))` error
bug.d(20):        instantiated from here: `S!uint`

A workaround to have this code compile with dlang2.100 would be appreciated.

Jul 29 2022