base: Assert Flags' type is unsigned
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Sat, 26 Dec 2020 00:52:00 +0000 (21:52 -0300)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Wed, 13 Jan 2021 11:15:18 +0000 (11:15 +0000)
Operations rely on the use of unsigned integers.

Change-Id: I825a88f81b54577585976d6558b1409870897721
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38712
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
src/base/flags.hh

index c9525fae277ecd9a849dfe4e683e339b5bacf8a0..505a1e54fc39e92707c3c6cf75efe205873ca3e5 100644 (file)
 #ifndef __BASE_FLAGS_HH__
 #define __BASE_FLAGS_HH__
 
+#include <type_traits>
+
 template <typename T>
 class Flags
 {
   private:
+    static_assert(std::is_unsigned<T>::value, "Flag type must be unsigned");
+
     T _flags;
 
   public: