[Issue 23413] New: Array __equals lowering fails to infer @safe with cryptic error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 14 14:02:23 UTC 2022


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

          Issue ID: 23413
           Summary: Array __equals lowering fails to infer @safe with
                    cryptic error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

```
@safe:

struct T
{
    S s;
}

struct S
{
    S[] s;
    T[] t;
}

void main()
{
    assert(S.init == S.init);
}
```

Error: incompatible types for array comparison: `S[]` and `S[]`
Error: incompatible types for array comparison: `T[]` and `T[]`

I think what's happening here is that `@safe` inference fails because of a
cyclic dependency (issue 7205), and the compiler gives a generic error when
lowering to `__equals` fails, which completely misses the mark.

--


More information about the Digitalmars-d-bugs mailing list