[Issue 23964] New: [REG2.102] inccorect error opAssign cannot be used ... @disable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 4 16:51:09 UTC 2023


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 at puremagic.com
          Reporter: johanengelen at 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

--


More information about the Digitalmars-d-bugs mailing list