[Issue 21497] "Error: unknown" for generating struct using CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 8 19:47:17 UTC 2023


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

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE
                 CC|                            |b2.temp at gmx.com

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
reduced and rewritten to track the issue better:

```
struct T
{
    ubyte[1] data;
}

void assignZero(ref ubyte[1] dst)
{
    dst[] = 0; // dst[0 .. 1] = 0; eliminates the ICE
}

int getInit()
{
    T r;
    assignZero(r.data);
    return 0;
}

enum int test = getInit();   
```

The problem seems to be related to CTFE + the slice assign lo and hi indexes +
ref parameter.

--


More information about the Digitalmars-d-bugs mailing list