www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19218] New: object.destroy should check for classes for

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

          Issue ID: 19218
           Summary: object.destroy should check for classes for static
                    arrays
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: doob me.com

The code for "object.destroy" for static arrays looks like:

void destroy(T : U[n], U, size_t n)(ref T obj) if (!is(T == struct))
{
    foreach_reverse (ref e; obj[])
        destroy(e);
}

I think the template constraint is to avoid structs that have an "alias this"
pointing to a static array. The same can happen for classes as well.

--
Sep 04 2018