Skip to content

Commit 0790c01

Browse files
committed
Avoid narrowing conversion in optional
This issue was causing compile warnings on Ubuntu 18, when compiling with conversion warnings enabled. The result of `size_of` was being converted to `unsigned` which is a narrowing conversion on 64 bit platforms. This commit fixes this issue by changing the type to `std::size_t`, which is large enough to store the resultof `size_of` without a narrowing conversion.
1 parent 0e6538a commit 0790c01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/nonstd/optional.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ struct alignment_of_hack
356356
alignment_of_hack();
357357
};
358358

359-
template <unsigned A, unsigned S>
359+
template <std::size_t A, std::size_t S>
360360
struct alignment_logic
361361
{
362362
enum { value = A < S ? A : S };

0 commit comments

Comments
 (0)