summaryrefslogtreecommitdiff
path: root/include/o3tl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-30 08:20:20 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-07-30 07:15:39 +0000
commitcebfe56ae5f9cee4b403370774040f35a17d223c (patch)
treeee5ef74632b70980e58af8e6c75a6be921622c11 /include/o3tl
parenta45827b2308febc7369db27fb489a6d1389534e1 (diff)
add assert for valid value in o3tl::typed_flags_set
, fixing a couple of bugs in the process Change-Id: I40f932deecbcc99dff9aa13dd1882c7487e7fa8e Reviewed-on: https://gerrit.libreoffice.org/17411 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include/o3tl')
-rw-r--r--include/o3tl/typed_flags_set.hxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
index d997f6ac6afc..d3ac7e276775 100644
--- a/include/o3tl/typed_flags_set.hxx
+++ b/include/o3tl/typed_flags_set.hxx
@@ -70,7 +70,10 @@ struct is_typed_flags {
public:
explicit Wrap(typename std::underlying_type<E>::type value):
value_(value)
- { assert(detail::isNonNegative(value)); }
+ {
+ assert(detail::isNonNegative(value));
+ assert((value & ~M) == 0);
+ }
operator E() { return static_cast<E>(value_); }