From ef475c4d7183a32c35e753f579e98da331867123 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Fri, 12 May 2017 20:33:32 +0000 Subject: [PATCH] [test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 1/3. 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 --- .../std/language.support/support.types/byteops/and.assign.pass.cpp | 6 +++--- libcxx/test/std/language.support/support.types/byteops/and.pass.cpp | 6 +++--- .../language.support/support.types/byteops/lshift.assign.pass.cpp | 4 ++-- .../test/std/language.support/support.types/byteops/lshift.fail.cpp | 2 +- .../test/std/language.support/support.types/byteops/lshift.pass.cpp | 4 ++-- libcxx/test/std/language.support/support.types/byteops/not.pass.cpp | 6 +++--- .../std/language.support/support.types/byteops/or.assign.pass.cpp | 6 +++--- libcxx/test/std/language.support/support.types/byteops/or.pass.cpp | 6 +++--- .../language.support/support.types/byteops/rshift.assign.pass.cpp | 4 ++-- .../test/std/language.support/support.types/byteops/rshift.fail.cpp | 2 +- .../test/std/language.support/support.types/byteops/rshift.pass.cpp | 4 ++-- .../std/language.support/support.types/byteops/to_integer.fail.cpp | 2 +- .../std/language.support/support.types/byteops/to_integer.pass.cpp | 4 ++-- .../std/language.support/support.types/byteops/xor.assign.pass.cpp | 6 +++--- libcxx/test/std/language.support/support.types/byteops/xor.pass.cpp | 6 +++--- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/libcxx/test/std/language.support/support.types/byteops/and.assign.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/and.assign.pass.cpp index dec241e..1c9790e 100644 --- a/libcxx/test/std/language.support/support.types/byteops/and.assign.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/and.assign.pass.cpp @@ -26,9 +26,9 @@ constexpr std::byte test(std::byte b1, std::byte b2) { 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(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; static_assert(noexcept(b &= b), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/and.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/and.pass.cpp index 22da6e3..7ed80a0 100644 --- a/libcxx/test/std/language.support/support.types/byteops/and.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/and.pass.cpp @@ -18,9 +18,9 @@ // 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(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; static_assert(noexcept(b1 & b8), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp index dad692e..f19a021 100644 --- a/libcxx/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp @@ -28,8 +28,8 @@ constexpr std::byte test(std::byte b) { 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(2)}; + constexpr std::byte b3{static_cast(3)}; static_assert(noexcept(b <<= 2), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/lshift.fail.cpp b/libcxx/test/std/language.support/support.types/byteops/lshift.fail.cpp index 6b1a68f..e2f7c95 100644 --- a/libcxx/test/std/language.support/support.types/byteops/lshift.fail.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/lshift.fail.cpp @@ -21,6 +21,6 @@ // is_integral_v is true. int main () { - constexpr std::byte b1{1}; + constexpr std::byte b1{static_cast(1)}; constexpr std::byte b2 = b1 << 2.0f; } diff --git a/libcxx/test/std/language.support/support.types/byteops/lshift.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/lshift.pass.cpp index 39d6590..831673a 100644 --- a/libcxx/test/std/language.support/support.types/byteops/lshift.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/lshift.pass.cpp @@ -21,8 +21,8 @@ // is_integral_v is true. int main () { - constexpr std::byte b1{1}; - constexpr std::byte b3{3}; + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b3{static_cast(3)}; static_assert(noexcept(b3 << 2), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/not.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/not.pass.cpp index 734780f..55f26f7 100644 --- a/libcxx/test/std/language.support/support.types/byteops/not.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/not.pass.cpp @@ -18,9 +18,9 @@ // 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(1)}; + constexpr std::byte b2{static_cast(2)}; + constexpr std::byte b8{static_cast(8)}; static_assert(noexcept(~b1), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/or.assign.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/or.assign.pass.cpp index 75d6ab4..51d9835 100644 --- a/libcxx/test/std/language.support/support.types/byteops/or.assign.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/or.assign.pass.cpp @@ -26,9 +26,9 @@ constexpr std::byte test(std::byte b1, std::byte b2) { 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(1)}; + constexpr std::byte b2{static_cast(2)}; + constexpr std::byte b8{static_cast(8)}; static_assert(noexcept(b |= b), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/or.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/or.pass.cpp index 02c547f..24e6fe7 100644 --- a/libcxx/test/std/language.support/support.types/byteops/or.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/or.pass.cpp @@ -18,9 +18,9 @@ // 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(1)}; + constexpr std::byte b2{static_cast(2)}; + constexpr std::byte b8{static_cast(8)}; static_assert(noexcept(b1 | b2), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp index b7e9a24..23db61c 100644 --- a/libcxx/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp @@ -28,8 +28,8 @@ constexpr std::byte test(std::byte b) { 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(16)}; + constexpr std::byte b192{static_cast(192)}; static_assert(noexcept(b >>= 2), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/rshift.fail.cpp b/libcxx/test/std/language.support/support.types/byteops/rshift.fail.cpp index a030953..74f19fd 100644 --- a/libcxx/test/std/language.support/support.types/byteops/rshift.fail.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/rshift.fail.cpp @@ -21,6 +21,6 @@ // is_integral_v is true. int main () { - constexpr std::byte b1{1}; + constexpr std::byte b1{static_cast(1)}; constexpr std::byte b2 = b1 >> 2.0f; } diff --git a/libcxx/test/std/language.support/support.types/byteops/rshift.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/rshift.pass.cpp index 8767325..9b1c258 100644 --- a/libcxx/test/std/language.support/support.types/byteops/rshift.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/rshift.pass.cpp @@ -27,8 +27,8 @@ constexpr std::byte test(std::byte b) { int main () { - constexpr std::byte b100{100}; - constexpr std::byte b115{115}; + constexpr std::byte b100{static_cast(100)}; + constexpr std::byte b115{static_cast(115)}; static_assert(noexcept(b100 << 2), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/to_integer.fail.cpp b/libcxx/test/std/language.support/support.types/byteops/to_integer.fail.cpp index 426ceb7..add3168 100644 --- a/libcxx/test/std/language.support/support.types/byteops/to_integer.fail.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/to_integer.fail.cpp @@ -21,6 +21,6 @@ // is_integral_v is true. int main () { - constexpr std::byte b1{1}; + constexpr std::byte b1{static_cast(1)}; auto f = std::to_integer(b1); } diff --git a/libcxx/test/std/language.support/support.types/byteops/to_integer.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/to_integer.pass.cpp index 21dff01..353ef3a 100644 --- a/libcxx/test/std/language.support/support.types/byteops/to_integer.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/to_integer.pass.cpp @@ -21,8 +21,8 @@ // is_integral_v is true. int main () { - constexpr std::byte b1{1}; - constexpr std::byte b3{3}; + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b3{static_cast(3)}; static_assert(noexcept(std::to_integer(b1)), "" ); static_assert(std::is_same(b1))>::value, "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/xor.assign.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/xor.assign.pass.cpp index c9b4017..0d2e7cf 100644 --- a/libcxx/test/std/language.support/support.types/byteops/xor.assign.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/xor.assign.pass.cpp @@ -26,9 +26,9 @@ constexpr std::byte test(std::byte b1, std::byte b2) { 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(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; static_assert(noexcept(b ^= b), "" ); diff --git a/libcxx/test/std/language.support/support.types/byteops/xor.pass.cpp b/libcxx/test/std/language.support/support.types/byteops/xor.pass.cpp index 3d0402b..fed71df 100644 --- a/libcxx/test/std/language.support/support.types/byteops/xor.pass.cpp +++ b/libcxx/test/std/language.support/support.types/byteops/xor.pass.cpp @@ -18,9 +18,9 @@ // 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(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; static_assert(noexcept(b1 ^ b8), "" ); -- 2.7.4