www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23964] New: [REG2.102] inccorect error opAssign cannot be

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

          Issue ID: 23964
           Summary: [REG2.102] inccorect error opAssign cannot be used ...
                     disable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

Requires `-de` compile flag.

Testcase:
```
ulong foo() {
    return 1;
}

void compileCheck(const(ClusterInfoJohan) src, ClusterInfoJohan tgt) {
    tgt = src;
}

struct ClusterInfoJohan {
    UUID guid;

    ulong oiuoi = 512;

    ulong asdasdasd = {
        foo();
        return 1;
    }();
}

struct UUID {
     safe  nogc
        opAssign(UUID) { }
}
```

`dmd -de -o- test.d` gives:
test.d(6): Error: generated function `test.ClusterInfoJohan.opAssign` cannot be
used because it is annotated with ` disable`

Compiles fine with DMD 2.101 or older.

Digger says it is caused by this commit:
9fc7c8ff643dbc88f84d95eb8e5b8956bcd29edb
https://github.com/dlang/dmd/pull/14483

--
Jun 04 2023