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

          Issue ID: 15408
           Summary: S.init for struct containing member field with array
                    literal initializer fails @nogc
           Product: D
           Version: D2
          Hardware: All
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

Code:
---
struct S
{
    uint[] arr = [42];
}

pure nothrow @safe @nogc unittest
{
    auto s = S.init;
}
---

Error:
---
test.d(3): Error: array literal in @nogc function __unittestL6_1 may cause GC
allocation
---

Loosely related to https://issues.dlang.org/show_bug.cgi?id=2947

--

Reply via email to