Index: gdb/common/enum-flags.h
--- gdb/common/enum-flags.h.orig
+++ gdb/common/enum-flags.h
@@ -51,6 +51,8 @@
 
 #ifdef __cplusplus
 
+#include <limits>
+
 /* Traits type used to prevent the global operator overloads from
    instantiating for non-flag enums.  */
 template<typename T> struct enum_flags_type {};
@@ -82,7 +84,7 @@ template<typename T>
 struct enum_underlying_type
 {
   typedef typename
-    integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
+    integer_for_size<sizeof (T), (std::numeric_limits<T>::lowest() < 0)>::type
     type;
 };
 
