From d476a5b4e7ef8fd0d31f9f6072886580ebdd6053 Mon Sep 17 00:00:00 2001 From: Daniel Scharrer Date: Thu, 1 Mar 2012 15:08:09 +0100 Subject: [PATCH] Don't assume enums are unsigned even if the range allows it. --- src/util/enum.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/enum.hpp b/src/util/enum.hpp index 45b05a9..fbb9d89 100644 --- a/src/util/enum.hpp +++ b/src/util/enum.hpp @@ -70,7 +70,7 @@ struct enum_names { template typename boost::enable_if_c::named, std::ostream &>::type operator<<(std::ostream & os, Enum value) { - if(value < enum_names::count) { + if(value >= 0 && size_t(value) < enum_names::count) { return os << enum_names::names[value]; } else { return os << "(unknown:" << int(value) << ')';