Skip to content

Commit 08f687f

Browse files
authored
Merge pull request #11 from cschreib/msvc-warning
Fix MSVC warning
2 parents 5534ea8 + 5b92451 commit 08f687f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.github/workflows/cmake.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on: push
44

55
env:
66
EM_VERSION: 2.0.16

include/oup/observable_unique_ptr.hpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,14 @@ class basic_control_block final {
198198
using control_block_storage_type =
199199
typename observer_policy_queries<Policy>::control_block_storage_type;
200200

201-
static constexpr control_block_storage_type highest_bit_mask =
202-
control_block_storage_type{1}
203-
<< control_block_storage_type{sizeof(control_block_storage_type) * 8 - 1};
201+
static constexpr control_block_storage_type get_highest_bit_mask() {
202+
// NB: This is put in a function to avoid a spurious MSVC warning.
203+
return static_cast<control_block_storage_type>(1)
204+
<< (static_cast<control_block_storage_type>(
205+
sizeof(control_block_storage_type) * 8 - 1));
206+
}
207+
208+
static constexpr control_block_storage_type highest_bit_mask = get_highest_bit_mask();
204209

205210
control_block_storage_type storage = 1;
206211

0 commit comments

Comments
 (0)