https://issues.dlang.org/show_bug.cgi?id=20527
Issue ID: 20527
Summary: std.json CTFE cannot read integer
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
std.json has a quirky implementation of integer parsing where it parses a ulong
for non-negative numbers, but then sets the tag to point at a long. This gives
CTFE fits because you are setting one member of a union, then reading a
different member.
Code to reproduce:
static assert(parseJSON(`{ "int": 2}`)["int"].integer == 2);
Error: reinterpretation through overlapped field integer is not allowed in CTFE
Easy to fix, set the correct union member.
--