mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
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
This commit is contained in:
parent
7fefaaf2c8
commit
d8c493c89f
@ -31,6 +31,10 @@ template <class T, class U, typename std::enable_if<std::is_arithmetic<T>::value
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false)
|
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
|
// clang-format on
|
||||||
constexpr T narrow(U u) noexcept(false)
|
constexpr T narrow(U u) noexcept(false)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user