Comment #0 by snarwin+bugzilla — 2023-11-03T00:55:55Z
As of DMD 2.105.3, the following program asserts at runtime:
---
import core.lifetime;
enum E : int[5] { a = [1, 2, 3, 4, 5] }
void main()
{
E e = void;
emplace(&e);
assert(e == E.init);
}
---
The message, with -checkaction=context, is
---
[email protected](9): cast(E) [0, 0, 0, 0, 0] != a
---
This happens because core.lifetime.emplace uses the .init value of the enum's base type, int, to initialize `e`, rather than the .init value of the enum itself.
Comment #1 by robert.schadek — 2024-12-07T13:42:58Z