summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorAndreas Schuh <andreas.schuh.84@gmail.com>2015-10-28 00:19:33 +0000
committerAndreas Schuh <andreas.schuh.84@gmail.com>2015-10-28 00:19:33 +0000
commit9db828953a1047c95bf5fb780c3c1f9453f806eb (patch)
tree67314847c05bb2453cebedaef5d1d97824332424 /src/util.h
parent4e61c45ef9b3321695a647003d6849d12cf161f8 (diff)
downloadgflags-9db828953a1047c95bf5fb780c3c1f9453f806eb.tar.gz
gflags-9db828953a1047c95bf5fb780c3c1f9453f806eb.tar.bz2
gflags-9db828953a1047c95bf5fb780c3c1f9453f806eb.zip
#125 Fix unused typedef/variable warning for static assertion
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h
index 366e1be..fb59b38 100644
--- a/src/util.h
+++ b/src/util.h
@@ -88,9 +88,10 @@ typedef unsigned char uint8;
// -- utility macros ---------------------------------------------------------
-template <bool> struct CompileAssert {};
+template <bool b> struct CompileAssert;
+template <> struct CompileAssert<true> {};
#define COMPILE_ASSERT(expr, msg) \
- typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
+ enum { assert_##msg = sizeof(CompileAssert<bool(expr)>) }
// Returns the number of elements in an array.
#define arraysize(arr) (sizeof(arr)/sizeof(*(arr)))