diff options
author | Kris <kristc@gmail.com> | 2016-09-07 22:16:10 +0100 |
---|---|---|
committer | Kris <kristc@gmail.com> | 2016-09-07 22:16:10 +0100 |
commit | 7d083fd08cb5fbf1e5e953adf72c2c38c258c888 (patch) | |
tree | 45ef414d7c79d0254c29c08a9760d8ace16038ac | |
parent | 55b232dde4189525fe211d0e7c8f952a3e3e061d (diff) | |
download | platform_external_Microsoft-GSL-7d083fd08cb5fbf1e5e953adf72c2c38c258c888.tar.gz platform_external_Microsoft-GSL-7d083fd08cb5fbf1e5e953adf72c2c38c258c888.tar.bz2 platform_external_Microsoft-GSL-7d083fd08cb5fbf1e5e953adf72c2c38c258c888.zip |
Issue #329, fixed build issues on clang
Fixed build issues that clang shows up the MS VS accepts.
-rw-r--r-- | gsl/gsl_byte | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gsl/gsl_byte b/gsl/gsl_byte index c973320..f502ab0 100644 --- a/gsl/gsl_byte +++ b/gsl/gsl_byte @@ -106,14 +106,15 @@ constexpr IntegerType to_integer(byte b) noexcept return {b}; } -template<bool, typename T> +template<bool E, typename T> constexpr byte to_byte_impl(T t) noexcept { static_assert( - false, + E, "gsl::to_byte(t) must be provided an unsigned char, otherwise data loss may occur. " "If you are calling to_byte with an integer contant use: gsl::to_byte<t>() version." - ) + ); + return static_cast<byte>(t); } template<> constexpr byte to_byte_impl<true, unsigned char>(unsigned char t) noexcept |