bug #1424: add numext::abs specialization for unsigned integer types.
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h
index 5ec6c39..0be4a25 100644
--- a/Eigen/src/Core/MathFunctions.h
+++ b/Eigen/src/Core/MathFunctions.h
@@ -1232,11 +1232,19 @@
 
 template<typename T>
 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
-typename NumTraits<T>::Real abs(const T &x) {
+typename internal::enable_if<NumTraits<T>::IsSigned || NumTraits<T>::IsComplex,typename NumTraits<T>::Real>::type
+abs(const T &x) {
   EIGEN_USING_STD_MATH(abs);
   return abs(x);
 }
 
+template<typename T>
+EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
+typename internal::enable_if<!(NumTraits<T>::IsSigned || NumTraits<T>::IsComplex),typename NumTraits<T>::Real>::type
+abs(const T &x) {
+  return x;
+}
+
 #if defined(__SYCL_DEVICE_ONLY__)
 EIGEN_ALWAYS_INLINE float   abs(float x) { return cl::sycl::fabs(x); }
 EIGEN_ALWAYS_INLINE double  abs(double x) { return cl::sycl::fabs(x); }
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8da51ce..e73ab92 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -148,6 +148,7 @@
 
 ei_add_test(rand)
 ei_add_test(meta)
+ei_add_test(numext)
 ei_add_test(sizeof)
 ei_add_test(dynalloc)
 ei_add_test(nomalloc)
diff --git a/test/main.h b/test/main.h
index 25d2dcf..bd53251 100644
--- a/test/main.h
+++ b/test/main.h
@@ -310,6 +310,17 @@
 template<> inline double test_precision<std::complex<double> >() { return test_precision<double>(); }
 template<> inline long double test_precision<std::complex<long double> >() { return test_precision<long double>(); }
 
+inline bool test_isApprox(const short& a, const short& b)
+{ return internal::isApprox(a, b, test_precision<short>()); }
+inline bool test_isApprox(const unsigned short& a, const unsigned short& b)
+{ return internal::isApprox(a, b, test_precision<unsigned long>()); }
+inline bool test_isApprox(const unsigned int& a, const unsigned int& b)
+{ return internal::isApprox(a, b, test_precision<unsigned int>()); }
+inline bool test_isApprox(const long& a, const long& b)
+{ return internal::isApprox(a, b, test_precision<long>()); }
+inline bool test_isApprox(const unsigned long& a, const unsigned long& b)
+{ return internal::isApprox(a, b, test_precision<unsigned long>()); }
+
 inline bool test_isApprox(const int& a, const int& b)
 { return internal::isApprox(a, b, test_precision<int>()); }
 inline bool test_isMuchSmallerThan(const int& a, const int& b)
diff --git a/test/numext.cpp b/test/numext.cpp
new file mode 100644
index 0000000..3de33e2
--- /dev/null
+++ b/test/numext.cpp
@@ -0,0 +1,53 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2017 Gael Guennebaud <gael.guennebaud@inria.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include "main.h"
+
+template<typename T>
+void check_abs() {
+  typedef typename NumTraits<T>::Real Real;
+
+  if(NumTraits<T>::IsSigned)
+    VERIFY_IS_EQUAL(numext::abs(-T(1)), T(1));
+  VERIFY_IS_EQUAL(numext::abs(T(0)), T(0));
+  VERIFY_IS_EQUAL(numext::abs(T(1)), T(1));
+
+  for(int k=0; k<g_repeat*100; ++k)
+  {
+    T x = internal::random<T>();
+    if(!internal::is_same<T,bool>::value)
+      x = x/Real(2);
+    if(NumTraits<T>::IsSigned)
+    {
+      VERIFY_IS_EQUAL(numext::abs(x), numext::abs(-x));
+      VERIFY( numext::abs(-x) >= Real(0));
+    }
+    VERIFY( numext::abs(x) >= Real(0));
+    VERIFY_IS_APPROX( numext::abs2(x), numext::abs2(numext::abs(x)) );
+  }
+}
+
+void test_numext() {
+  CALL_SUBTEST( check_abs<bool>() );
+  CALL_SUBTEST( check_abs<signed char>() );
+  CALL_SUBTEST( check_abs<unsigned char>() );
+  CALL_SUBTEST( check_abs<short>() );
+  CALL_SUBTEST( check_abs<unsigned short>() );
+  CALL_SUBTEST( check_abs<int>() );
+  CALL_SUBTEST( check_abs<unsigned int>() );
+  CALL_SUBTEST( check_abs<long>() );
+  CALL_SUBTEST( check_abs<unsigned long>() );
+  CALL_SUBTEST( check_abs<half>() );
+  CALL_SUBTEST( check_abs<float>() );
+  CALL_SUBTEST( check_abs<double>() );
+  CALL_SUBTEST( check_abs<long double>() );
+
+  CALL_SUBTEST( check_abs<std::complex<float> >() );
+  CALL_SUBTEST( check_abs<std::complex<double> >() );
+}