#3578·json

Unable to use gnu mpz types for NumberIntegerType

Author: eric-wieserCreated Jul 11, 2022Updated Sep 28, 2026
Labelskind: bugstate: stale

Description

I was hoping it would be possible to set NumberIntegerType and NumberUnsignedType (putting aside #2573 for now) to an arbitrary precision integer type ("big integers"), such as on wrapper types around the gnu multiple precision arithmetic library.

Unfortunately, this is not permitted as json_value is a C-style tagged union that doesn't permit any of its types to have non-trivial destructors/move constructors etc; and mpz is stored on the heap.

I understand this is quite a big ask, but I thought it was worth having an issue explicitly mentioning big integers since I wasn't able to find an existing one via search.

Reproduction steps

Attempt to use some numeric heap type for the numeric type parameters. I'm afraid I don't have a trivial example to hand without external dependencies.

Expected vs. actual results

In an ideal world, I would expect everthing to just work. Instead, I get compiler errors about deleted operators on json_value due to it being a union of non trivial types.

Minimal code example

No response

Error messages

No response

Compiler and operating system

N/A

Library version

d4daaa897f48bf7bb2f96b46b84e49f32dd11daf

Validation