Skip to content
Commit ede1cf4a authored by Igor Kushnir's avatar Igor Kushnir
Browse files

Don't cast out-of-enum-range -1 to CommonIntegralTypes

This fixes the following Clang 16 compilation error:
kdevelop/plugins/clang/duchain/cursorkindtraits.h:217:7: error: integer value -1 is outside the valid range of values [0, 255] for the enumeration type 'CommonIntegralTypes' [-Wenum-constexpr-conversion]
    : static_cast<IntegralType::CommonIntegralTypes>(-1);

Quote from https://github.com/llvm/llvm-project/issues/59036 :
    The -Wenum-constexpr-conversion warning was created to account for
    the fact that casting integers to enums outside of the valid range
    of the enum is UB in C++17. Constant expressions invoking UB lead to
    an ill-formed program.

BUG: 471995
FIXED-IN: 5.12.230800
parent 071e47cb
Pipeline #433152 passed with stage
in 13 minutes and 42 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment