www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19652] New: [REG2.084] alias this chain no longer works

https://issues.dlang.org/show_bug.cgi?id=19652

          Issue ID: 19652
           Summary: [REG2.084] alias this chain no longer works
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

The following code used to compile but no longer does with dmd 2.084:
```
struct Base {
    int i;
}

struct A {
    Base base;
    alias base this;
}

struct B {
    A a;
    alias a this;
}

auto asGeneric(inout ref Base block)  nogc {
    return █
}

B* thingie;
auto foo() {
    return asGeneric(*thingie);
}
```

Error: `cast(Base)(*thingie).a` is not an lvalue and cannot be modified

--
Feb 05 2019