You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having the same issue and apologies if I am not understanding this correctly as I am new to C++ and have only just started using this library, but it looks like the integer value is not being considered a basic_json and so is calling the explicit cast from_json. At least the comment above the function leads me to believe this. // overload for arithmetic types, not chosen for basic_json template arguments // (BooleanType, etc..); note: Is it really necessary to provide explicit // overloads for boolean_t etc. in case of a custom BooleanType which is not // an arithmetic type?
Description
Converting from
"value": true
or"value": false
behaves unexpectedly and differently for certain integer types.I was expecting all conversions from a boolean true/false to integer value to fail, however it is stored as a 1 or 0.
Reproduction steps
Given:
This will result in a
1
invalue
.Using
uint64_t
will throw atype_error
.Expected vs. actual results
I expected all boolean to integer conversions to fail. Instead a
true
->1
andfalse
->0
for certain integer values.Various integer conversions - https://godbolt.org/z/7Wrh6EanW
The
uint64_t
case is taking the path throughget_arithmetic_value
The
int
case is taking the path throughMinimal code example
https://godbolt.org/z/fs4frqz7G
Error messages
No response
Compiler and operating system
Latest MSVC & Clang
Library version
3.11.3
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: