[Issue 7752] New: Static array .init is actually .init of the array element type, not the array.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 22 08:33:42 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7752

           Summary: Static array .init is actually .init of the array
                    element type, not the array.
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: david.eckardt at sociomantic.com


--- Comment #0 from David Eckardt <david.eckardt at sociomantic.com> 2012-03-22 08:34:02 PDT ---
Let T be a type and n a size_t constant, then T[n].init is the same as T.init.

This causes the program code

---
    {
        int[5] x;

        if (x == x.init) { /* ... */ }
    }
---

to be rejected with the compiler error message "Error: incompatible types for
((x) == (0)): 'int[5u]' and 'int'", whereas

---
    static assert(x.init == x[0].init);
---

passes successfully.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list