diff --git a/format.ipp b/format.ipp index 6efc8da1..42ac2461 100644 --- a/format.ipp +++ b/format.ipp @@ -729,8 +729,8 @@ namespace util { namespace format { namespace detail { if (spec.k != (std::is_unsigned::value ? specifier::kind::UNSIGNED : specifier::kind::SIGNED)) throw conversion_error ("invalid conversion specifier for integer value"); - if (spec.length != sizeof (ValueT)) - throw length_error ("incorrect value size"); + if (sizeof (ValueT) > spec.length) + throw length_error ("overlength value parameter"); const auto numerals = digits (t, spec.base); const auto characters = numerals + (spec.positive_char ? 1 : 0); diff --git a/test/format.cpp b/test/format.cpp index 119d84c0..0628ea58 100644 --- a/test/format.cpp +++ b/test/format.cpp @@ -167,7 +167,7 @@ main (void) CHECK_THROW("%i", conversion_error, nullptr); CHECK_THROW("%hhi", length_error, (long long)1); - CHECK_THROW("%lli", length_error, (signed char)1); + //CHECK_THROW("%lli", length_error, (signed char)1); CHECK_THROW("%u", conversion_error, 1.); CHECK_THROW("%u", conversion_error, "foo"); @@ -176,7 +176,7 @@ main (void) CHECK_THROW("%u", conversion_error, nullptr); CHECK_THROW("%hhu", length_error, (unsigned long long)1); - CHECK_THROW("%llu", length_error, (unsigned char)1); + //CHECK_THROW("%llu", length_error, (unsigned char)1); CHECK_THROW("%f", conversion_error, 1u); CHECK_THROW("%f", conversion_error, "foo");