[Bug c++/94422] [9/10 Regression] static_cast from std::array operator[] to enum class
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 31 10:24:07 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94422
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9 Regression] static_cast |[9/10 Regression]
|from std::array operator[] |static_cast from std::array
|to enum class |operator[] to enum class
Known to fail| |10.0
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:
// { dg-options "-std=gnu++17" }
template<typename T, unsigned N>
struct array
{
T data[N];
constexpr T& operator[](unsigned n) { return data[n]; }
};
enum class EnumC : signed char { Forward = 1, Backward = -1 };
array<unsigned char, sizeof(EnumC)> buf;
template <typename T>
struct S {
void foo() { auto const cast_to_enum{static_cast<EnumC>(buf[0])}; }
};
S<int> s;
More information about the Gcc-bugs
mailing list