www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23674] New: incompatible types for array comparison: string

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

          Issue ID: 23674
           Summary: incompatible types for array comparison: string and
                    string
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

Manjaro/Arch x86_64, dmd 2.102.0 fetched with install.sh.

Unhelpful error message when comparing an out-of-bounds element of an array
with a value of the same element type.

---

void main()
{
    string[2] arr;
    assert(arr[2] == string.init);
}

---

onlineapp.d(4): Error: incompatible types for array comparison: `string` and
`string`

--
Feb 06 2023