Extended Description
Hi,
The following code is undefined behavior in C++17. And undefined behavior is not allowed in constant expressions - the compiler is required to diagnose it. Adapted from cppreference:
enum foo { a = 0, b = 1 };
constexpr foo x = static_cast(123); // undefined behavior since C++17
However Clang happily compiles this code:
https://godbolt.org/z/bzhWMxqoE
Extended Description
Hi,
The following code is undefined behavior in C++17. And undefined behavior is not allowed in constant expressions - the compiler is required to diagnose it. Adapted from cppreference:
enum foo { a = 0, b = 1 };
constexpr foo x = static_cast(123); // undefined behavior since C++17
However Clang happily compiles this code:
https://godbolt.org/z/bzhWMxqoE