From 0a328c01253f49f23f6e1095318c9223c8ae66d7 Mon Sep 17 00:00:00 2001 From: theomegacarrot Date: Fri, 17 Mar 2023 14:09:30 -0400 Subject: [PATCH] address requested changes --- test/std-test.cc | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/test/std-test.cc b/test/std-test.cc index 81d365a0..278cef77 100644 --- a/test/std-test.cc +++ b/test/std-test.cc @@ -96,24 +96,19 @@ TEST(std_test, optional) { #endif } -// this struct exists only to force a variant to be -// valueless by exception -// NOLINTNEXTLINE -struct throws_on_move_t { - throws_on_move_t() = default; +struct throws_on_move { + throws_on_move() = default; - // NOLINTNEXTLINE - [[noreturn]] throws_on_move_t(throws_on_move_t&&) { - throw std::runtime_error{"Thrown by throws_on_move_t"}; + [[noreturn]] throws_on_move(throws_on_move&&) { + throw std::runtime_error("Thrown by throws_on_move_t"); } - throws_on_move_t(const throws_on_move_t&) = default; + throws_on_move(const throws_on_move&) = default; }; -template <> struct fmt::formatter : formatter { - template - auto format(const throws_on_move_t&, FormatContext& ctx) const { - string_view str{""}; +template <> struct fmt::formatter : formatter { + auto format(const throws_on_move&, format_context& ctx) const { + string_view str(""); return formatter::format(str, ctx); } }; @@ -150,13 +145,11 @@ TEST(std_test, variant) { volatile int i = 42; // Test compile error before GCC 11 described in #3068. EXPECT_EQ(fmt::format("{}", i), "42"); - using V2 = std::variant; - - V2 v6{}; + std::variant v6; try { - throws_on_move_t thrower{}; - v6.emplace(std::move(thrower)); + throws_on_move thrower; + v6.emplace(std::move(thrower)); } catch (const std::runtime_error&) { } // v6 is now valueless by exception