diff --git a/include/linphone/utils/static-string.h b/include/linphone/utils/static-string.h index ae65f6668..67b20884f 100644 --- a/include/linphone/utils/static-string.h +++ b/include/linphone/utils/static-string.h @@ -111,13 +111,19 @@ namespace Private { RawStaticString raw; private: - template= 0, int>::type* = nullptr> - constexpr StaticIntStringHelper (const IndexSequence &) : - raw{ char('0' + Value / pow10(N - Index - 2) % 10 )..., '\0' } {} + template + static bool testInt (T n) { + // Do not use it directly in the two enable_if below. (MSVC 2015 bug.) + return n < 0; + } - template::type* = nullptr> + template(Value), int>::type* = nullptr> constexpr StaticIntStringHelper (const IndexSequence &) : - raw{ '-', char('0' + abs(Value) / pow10(N - Index - 3) % 10 )..., '\0' } {} + raw{ char('0' + Value / pow10(N - Index - 2) % 10)..., '\0' } {} + + template(Value), int>::type* = nullptr> + constexpr StaticIntStringHelper (const IndexSequence &) : + raw{ '-', char('0' + abs(Value) / pow10(N - Index - 3) % 10)..., '\0' } {} }; };