mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::json: Add uint64_t ctor to value.
This ctor is actually not supposed to be used, so it gives a pseudo-narrowing warning. Not having this ctor simply gives a compile error which makes very little sense to the developer who is simply trying to pass a commonly used size_t et al.
This commit is contained in:
parent
b42dffb24c
commit
5e9a82af86
1 changed files with 8 additions and 0 deletions
|
@ -139,6 +139,7 @@ struct ircd::json::value
|
|||
namespace ircd::json
|
||||
{
|
||||
template<> value::value(const double &floating);
|
||||
template<> value::value(const uint64_t &integer);
|
||||
template<> value::value(const int64_t &integer);
|
||||
template<> value::value(const float &floating);
|
||||
template<> value::value(const int32_t &integer);
|
||||
|
@ -291,6 +292,13 @@ ircd::json::value::value(const double &floating)
|
|||
,floats{true}
|
||||
{}
|
||||
|
||||
template<>
|
||||
__attribute__((warning("uint64_t narrows to int64_t when used in json::value")))
|
||||
inline
|
||||
ircd::json::value::value(const uint64_t &integer)
|
||||
:value{int64_t(integer)}
|
||||
{}
|
||||
|
||||
template<> inline
|
||||
ircd::json::value::value(const float &floating)
|
||||
:value{double(floating)}
|
||||
|
|
Loading…
Reference in a new issue