This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.
This part changes the code.
Fixes D32386.
llvm-svn: 302944
int main () {
std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b1{1};
- constexpr std::byte b8{8};
- constexpr std::byte b9{9};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
static_assert(noexcept(b &= b), "" );
// constexpr byte operator&(byte l, byte r) noexcept;
int main () {
- constexpr std::byte b1{1};
- constexpr std::byte b8{8};
- constexpr std::byte b9{9};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
static_assert(noexcept(b1 & b8), "" );
int main () {
std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b2{2};
- constexpr std::byte b3{3};
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b3{static_cast<std::byte>(3)};
static_assert(noexcept(b <<= 2), "" );
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{1};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
constexpr std::byte b2 = b1 << 2.0f;
}
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{1};
- constexpr std::byte b3{3};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b3{static_cast<std::byte>(3)};
static_assert(noexcept(b3 << 2), "" );
// constexpr byte operator~(byte b) noexcept;
int main () {
- constexpr std::byte b1{1};
- constexpr std::byte b2{2};
- constexpr std::byte b8{8};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
static_assert(noexcept(~b1), "" );
int main () {
std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b1{1};
- constexpr std::byte b2{2};
- constexpr std::byte b8{8};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
static_assert(noexcept(b |= b), "" );
// constexpr byte operator|(byte l, byte r) noexcept;
int main () {
- constexpr std::byte b1{1};
- constexpr std::byte b2{2};
- constexpr std::byte b8{8};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b2{static_cast<std::byte>(2)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
static_assert(noexcept(b1 | b2), "" );
int main () {
std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b16{16};
- constexpr std::byte b192{192};
+ constexpr std::byte b16{static_cast<std::byte>(16)};
+ constexpr std::byte b192{static_cast<std::byte>(192)};
static_assert(noexcept(b >>= 2), "" );
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{1};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
constexpr std::byte b2 = b1 >> 2.0f;
}
int main () {
- constexpr std::byte b100{100};
- constexpr std::byte b115{115};
+ constexpr std::byte b100{static_cast<std::byte>(100)};
+ constexpr std::byte b115{static_cast<std::byte>(115)};
static_assert(noexcept(b100 << 2), "" );
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{1};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
auto f = std::to_integer<float>(b1);
}
// is_integral_v<IntegerType> is true.
int main () {
- constexpr std::byte b1{1};
- constexpr std::byte b3{3};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b3{static_cast<std::byte>(3)};
static_assert(noexcept(std::to_integer<int>(b1)), "" );
static_assert(std::is_same<int, decltype(std::to_integer<int>(b1))>::value, "" );
int main () {
std::byte b; // not constexpr, just used in noexcept check
- constexpr std::byte b1{1};
- constexpr std::byte b8{8};
- constexpr std::byte b9{9};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
static_assert(noexcept(b ^= b), "" );
// constexpr byte operator^(byte l, byte r) noexcept;
int main () {
- constexpr std::byte b1{1};
- constexpr std::byte b8{8};
- constexpr std::byte b9{9};
+ constexpr std::byte b1{static_cast<std::byte>(1)};
+ constexpr std::byte b8{static_cast<std::byte>(8)};
+ constexpr std::byte b9{static_cast<std::byte>(9)};
static_assert(noexcept(b1 ^ b8), "" );