aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2016-10-13 10:11:30 +0200
committerSimon Warta <[email protected]>2016-10-13 10:11:30 +0200
commitd137c28ccc212067e43bfe17ac8328bec0f944fe (patch)
tree2ad08cad4e3b141c76333fccdf0e421938e908b9 /src
parent1d59daf22602bd0b760bc22cf28eeafdc8076314 (diff)
Diable static_assert in secure_allocator in MSVC debug
Diffstat (limited to 'src')
-rw-r--r--src/lib/base/secmem.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/base/secmem.h b/src/lib/base/secmem.h
index ff76e9429..a99132507 100644
--- a/src/lib/base/secmem.h
+++ b/src/lib/base/secmem.h
@@ -24,7 +24,16 @@ template<typename T>
class secure_allocator
{
public:
+ /*
+ * Assert exists to prevent someone from doing something that will
+ * probably crash anyway (like secure_vector<non_POD_t> where ~non_POD_t
+ * deletes a member pointer which was zeroed before it ran).
+ * MSVC in debug mode uses non-integral proxy types in container types
+ * like std::vector, thus we disable the check there.
+ */
+#if !defined(_ITERATOR_DEBUG_LEVEL) || _ITERATOR_DEBUG_LEVEL == 0
static_assert(std::is_integral<T>::value, "secure_allocator supports only integer types");
+#endif
typedef T value_type;