summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2019-01-24 15:13:07 +0100
committerDaniel Carvalho <odanrc@yahoo.com.br>2019-04-19 16:34:00 +0000
commitf699e91fe53870b6a7f0e9fe61cc92fc44b1033b (patch)
tree1c90f19dcb7b40350d3d6fe247d75f3f1d3ae856
parent5fabb992ffa9cbde09105ec21c45e8cff282949e (diff)
downloadgem5-f699e91fe53870b6a7f0e9fe61cc92fc44b1033b.tar.xz
mem-cache: Assert Entry inherits from QueueEntry in Queue
Queue has several assumptions regarding its template parameter, so make sure they are fulfilled by forcing Entry to be derived from QueueEntry. Change-Id: I0203a62aec00c04ac89e9674d86a44a07f9f13ab Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17529 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
-rw-r--r--src/mem/cache/queue.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mem/cache/queue.hh b/src/mem/cache/queue.hh
index 36ddb96c2..6c8a19265 100644
--- a/src/mem/cache/queue.hh
+++ b/src/mem/cache/queue.hh
@@ -51,6 +51,7 @@
#include <cassert>
#include <string>
+#include <type_traits>
#include "base/logging.hh"
#include "base/trace.hh"
@@ -68,6 +69,9 @@
template<class Entry>
class Queue : public Drainable
{
+ static_assert(std::is_base_of<QueueEntry, Entry>::value,
+ "Entry must be derived from QueueEntry");
+
protected:
/** Local label (for functional print requests) */
const std::string label;