diff options
author | dmitrykobets-msft <89153909+dmitrykobets-msft@users.noreply.github.com> | 2022-04-28 19:49:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 19:49:38 +0300 |
commit | d8c493c89fef3b1928803cf0af5a21630344ea7e (patch) | |
tree | b84964a70f5abe3f99909fd3b8d4434574456965 | |
parent | 7fefaaf2c857782a70f6a0ba743cd93dba72f6c8 (diff) |
Suppress es.46 warning in implementation of gsl::narrow (#1046)
As per the CoreGuidelines, gsl::narrow is defined in terms of static_cast.
Suppress es.46, which suggests converting the static_cast into gsl::narrow
-rw-r--r-- | include/gsl/narrow | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/gsl/narrow b/include/gsl/narrow index 32d271e..7578c8b 100644 --- a/include/gsl/narrow +++ b/include/gsl/narrow @@ -31,6 +31,10 @@ template <class T, class U, typename std::enable_if<std::is_arithmetic<T>::value // clang-format off
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false)
+GSL_SUPPRESS(es.46) // NO-FORMAT: attribute // The warning suggests that a floating->unsigned conversion can occur
+ // in the static_cast below, and that gsl::narrow should be used instead.
+ // Suppress this warning, since gsl::narrow is defined in terms of
+ // static_cast
// clang-format on
constexpr T narrow(U u) noexcept(false)
{
|