userver-framework / userver

Production-ready C++ Asynchronous Framework with rich functionality
https://userver.tech
Apache License 2.0
2.39k stars 278 forks source link

Enum Out-of-Range Conversion Error #623

Closed Cn-Asukai closed 3 months ago

Cn-Asukai commented 3 months ago

I encountered an error when compiling through commands

cmake -S./ -B./build_debug  -DCMAKE_BUILD_TYPE=Debug  -DUSERVER_INSTALL=ON  -DUSERVER_FEATURE_POSTGRESQL=ON -DUSERVER_FEATURE_GRPC=ON  -DUSERVER_SANITIZE="ub addr"
cmake --build build_debug/
/usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
   73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
      |                               ^
/usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
   24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
      | 
apolukhin commented 3 months ago

Could you please provide a whole error message. The issue is probably triggered by some misuse of Boost.MPL

w15eacre commented 3 months ago

https://github.com/llvm/llvm-project/issues/59036 How I can understand clang removed ability to downgrade warning(-Wenum-constexpr-conversion) because conversion a value that is out of range enum value is UB. https://reviews.llvm.org/D150226

Cn-Asukai commented 3 months ago

llvm/llvm-project#59036 我如何理解 clang 删除了降级警告(-Wenum-constexpr-conversion)的能力,因为转换超出范围的枚举值是 UB。 https://reviews.llvm.org/D150226

Yes, I was using the Clang compiler, and when I switched to GCC, it compiled successfully.