[Issue 19218] New: object.destroy should check for classes for static arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 4 11:32:18 UTC 2018


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 at puremagic.com
          Reporter: doob at 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.

--


More information about the Digitalmars-d-bugs mailing list