Clang accepts the undefined behavior operation in a constant expression #56528
Labels
c++20
clang:diagnostics
New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
duplicate
Resolved as duplicate
According to [expr.static.cast p10
[dcl.enum] p8 defines the range of the enumeration values, which says
In this case, it is sufficient to represent the value
0
of the unique enumerator ifM
is1
. Apparently, the value1024
cannot be representable in the hypothetical integer type with minimal width M. So, the full-expression of the initialization is not a constant expression since the violation of [expr.const] p5However, Clang accepts this example without any diagnosis.
The text was updated successfully, but these errors were encountered: