www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23413] New: Array __equals lowering fails to infer safe with

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

--
Oct 14 2022