From 5e9a82af86493ebdd0a85c09879f66a818e779cc Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 25 Nov 2017 14:07:25 -0700 Subject: [PATCH] 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. --- include/ircd/json/value.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/ircd/json/value.h b/include/ircd/json/value.h index 9c2829feb..02121b8c1 100644 --- a/include/ircd/json/value.h +++ b/include/ircd/json/value.h @@ -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)}