www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20088] New: void[] cast unusable in betterC due to new

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

          Issue ID: 20088
           Summary: void[] cast unusable in betterC due to new __ArrayCast
                    template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: mail skoppe.eu

---

struct S {
    int i;
}

extern(C) int main()
{
    S[2] s = [S(1),S(2)];
    void[] v = cast(void[])s;
    S[] p = cast(S[])v; // cast of void[] to S[] triggers __ArrayCast template
function
    return 0;
}

---

/dlang/dmd/linux/bin64/../../src/druntime/import/object.d:4847: error:
undefined reference to
'_D4core8internal6string17TempStringNoAlloc3getMFNaNbNiNjNfZAa'

__ArrayCast is a templated function that drags in TempStringNoAlloc.get which
isn't available in betterC.

The example is silly but casts from void[] happen a lot in allocator code.

--
Jul 27 2019