You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MSVC static analyser warns for gsl::narrow_cast, to use gsl::narrow_cast #688
When gsl/gsl is included in the precompiled header, everything is compiled, and checked by the static analyser.
The static analyser in MSVC, using the CppCoreCheckRules, returns a single curious warning:
c:\src\vcpkg\installed\x64-windows\include\gsl\gsl_util(93): warning C26472: Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narow (type.1).
How about preceding the static_cast in narrow_cast with [[gsl::suppress(type.1)]]?
Please compare PR #642 .
If [[gsl::suppress(type.1)]] really works with MSVC (did you test it?) it might be a better alternative than the change that I suggested.
Activity
beinhaerter commentedon May 28, 2018
Please compare PR #642 .
If
[[gsl::suppress(type.1)]]really works with MSVC (did you test it?) it might be a better alternative than the change that I suggested.Farwaykorse commentedon May 30, 2018
Yes, this is the same issue as in #642.
I did test it (for the case mentioned here):
For MSVC (VS v15.7) it works.
But there was an issue when compiling with Clang (v6.0.0 on Windows).
I'll add a comment in the pull request.
Farwaykorse commentedon Oct 11, 2018
Fixed with #703.