The as<T>() method would trigger the following warning on GCC <7:
warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return *reinterpret_cast<T *>(Union.buffer); ^
Union.buffer is guaranteed to be aligned to whatever types it contains,
and json::Value maintains the invariant that it only calls as<T>() for a
T it has previously placement-newed into Union.buffer. This should
follow the rules for strict aliasing.
Using two static_cast via void * instead of reinterpret_cast
silences the warning and presumably makes GCC understand that no
strict-aliasing violation is happening.
No functional change intended.
Patch by: kimgr (Kim Gräsman)