www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22082] New: static float array comparison not available in

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

          Issue ID: 22082
           Summary: static float array comparison not available in betterC
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: betterC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

Array comparisons either:
- directly generate memcmp code (integral types) in e2ir.d
- call _adEq2 from druntime which uses TypeInfo
- are lowered to object.__equals in expressionsem.d

Comparing `float` arrays works in betterC through object.__equals, but when
both arguments are static arrays, the lowering doesn't happen:
```
// compile with -betterC
void main() {
    float[3] a, b;
    const x = a[] == b; // fine
    const y = a == b; // Error: `TypeInfo` cannot be used with -betterC
}
```

--
Jun 24 2021