From 0af8e20f7a3b0e073ed8ca92f224e7487a94ab52 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Fri, 19 Apr 2024 20:37:22 +0200 Subject: [PATCH] Fix overload of abs for char type (part 2) --- include/xsimd/arch/xsimd_scalar.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/xsimd/arch/xsimd_scalar.hpp b/include/xsimd/arch/xsimd_scalar.hpp index 02144e569..38b9f841d 100644 --- a/include/xsimd/arch/xsimd_scalar.hpp +++ b/include/xsimd/arch/xsimd_scalar.hpp @@ -93,11 +93,15 @@ namespace xsimd namespace detail { - inline char abs(char v, std::true_type) + // Use templated type here to prevent automatic instantiation that may + // ends up in a warning + template + inline char abs(char_type v, std::true_type) { return v; } - inline char abs(char v, std::false_type) + template + inline char abs(char_type v, std::false_type) { return v < 0 ? -v : v; }