[PATCH] D150647: [WIP][analyzer] Fix EnumCastOutOfRangeChecker C++17 handling
Endre Fülöp via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 16 10:46:48 PDT 2023
gamesh411 added a comment.
In D150647#4345345 <https://reviews.llvm.org/D150647#4345345>, @steakhal wrote:
>> In C++17 the initialization rules for enum classes are relaxed.
>
> In what way are they relaxed compared to regular enums?
The initialization rules are relaxed compared to their pre-C++17 state, so now there is a possibility of an initialization for enum classes without explicitly mentioning the underlying type.
I have updated the revision body.
That all being said, there is another fundamental issue with this checker, namely that the possible value range is I think restricted to the ones explicitly mentioned in the enumerators.
For example in the std::byte case even the old way of initializing gives a false positive.
I am investigating the issue, and have found so far, that fixed underlying-typed and non-fixed underlying-typed enums behave differently, which is not considered in the checker code.
Relevant info dump for future quoting:
https://eel.is/c++draft/dcl.enum#5
https://eel.is/c++draft/dcl.enum#7
https://eel.is/c++draft/dcl.enum#8
https://eel.is/c++draft/expr.static.cast#10
https://eel.is/c++draft/conv.fpint
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150647/new/
https://reviews.llvm.org/D150647
More information about the cfe-commits
mailing list