[Bug Report][CLion] std::underlying_type detected as int instead of int16_t
Hi team,
First, thanks for everything, CLion makes my life much easier.
I've found some unexpected behavior regarding std::underlying_type and CLion warnings. I am receiving the warning:
"Values of type int may not fit into the receiver type int16_t" in the following circumstance:
We have defined a method to cast an object of an enumerated class type to the std::underlying_type of that enum class, call it utype_cast. Let foo be an enumerated class with std::underling_type int16_t (enum class foo : int16_t). I have confirmed that sizeof(utype_cast(foo)) == sizeof(int16_t), however CLion yields the above warning when I assign int16_t bar = utype_cast(foo). It seems CLion is incorrectly deducing the std::underlying_type of enum class foo : int16_t. This is a very non-critical issue, but I would be interested to hear if anyone has a plausible explanation. Thanks very much!
Please sign in to leave a comment.
Hi, @Gfoster, thank you for the detailed description!
I've created the issue in our tracker: https://youtrack.jetbrains.com/issue/CPP-11821. Follow it to get updates.