--- title: Warning C26453 description: "Describes the causes of MSVC code analysis warning C26453, and shows how to fix it." ms.date: 07/15/2020 f1_keywords: ["C26453", "LEFTSHIFT_NEGATIVE_SIGNED_NUMBER"] helpviewer_keywords: ["C26453"] --- # Warning C26453 > Arithmetic overflow: Left shift of a negative signed number is undefined behavior (io.4) ## Remarks This warning indicates the code left shifts a negative signed integral value, which is non-portable and triggers implementation defined behavior. Code analysis name: `LEFTSHIFT_NEGATIVE_SIGNED_NUMBER` ## Example ```cpp void leftshift(int shiftCount) { const auto result = -1 << shiftCount; // C26453 reported here // code } ``` To correct this warning, use the following code: ```cpp void leftshift(int shiftCount) { const auto result = static_cast(-1) << shiftCount; // OK // code } ``` ## See also [ES.102: Use signed types for arithmetic](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-unsigned)