From 120d863c40a172b1aacd2116ea9c517012b190e8 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 9 Sep 2021 09:26:23 +0200 Subject: [PATCH] test: `derived_quantity`-related compilation error fixed --- test/unit_test/static/quantity_test.cpp | 39 +++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test/unit_test/static/quantity_test.cpp b/test/unit_test/static/quantity_test.cpp index 81d94a86..12567ba7 100644 --- a/test/unit_test/static/quantity_test.cpp +++ b/test/unit_test/static/quantity_test.cpp @@ -240,31 +240,32 @@ static_assert(length(1500_q_m).number() == 1.5); template struct derived_quantity : quantity { - using dimension = typename Q::dimension; - using unit = typename Q::unit; - using rep = Rep; - using R = quantity; + using dimension = typename Q::dimension; + using unit = typename Q::unit; + using rep = Rep; + using R = quantity; - constexpr derived_quantity() : R(){}; - constexpr explicit(!std::is_trivial_v) derived_quantity(const R& t) : R(t) {} - constexpr explicit(!std::is_trivial_v) derived_quantity(R&& t) : R(std::move(t)) {} + derived_quantity() = default; + constexpr explicit(!std::is_trivial_v) derived_quantity(const R& t) : R(t) {} + constexpr explicit(!std::is_trivial_v) derived_quantity(R&& t) : R(std::move(t)) {} - constexpr derived_quantity& operator=(const R& t) { R::operator=(t); return *this; } - constexpr derived_quantity& operator=(R&& t) { R::operator=(std::move(t)); return *this; } + constexpr derived_quantity& operator=(const R& t) { R::operator=(t); return *this; } + constexpr derived_quantity& operator=(R&& t) { R::operator=(std::move(t)); return *this; } - constexpr operator R&() & noexcept { return *this; } - constexpr operator const R&() const & noexcept { return *this; } - constexpr operator R&&() && noexcept { return *this; } - constexpr operator const R&&() const && noexcept { return *this; } + constexpr operator R&() & noexcept { return *this; } + constexpr operator const R&() const & noexcept { return *this; } + constexpr operator R&&() && noexcept { return *this; } + constexpr operator const R&&() const && noexcept { return *this; } }; static_assert(detail::is_quantity, "NTTP type description">>); -constexpr isq::Length auto get_length_derived_quantity() noexcept { - derived_quantity, "NTTP type description"> a; - a += 1_q_m; - a = a + 1_q_m; - a *= 0.5; - return a; +constexpr isq::Length auto get_length_derived_quantity() noexcept +{ + derived_quantity, "NTTP type description"> a{}; + a += 1_q_m; + a = a + 1_q_m; + a *= 0.5; + return a; } static_assert(get_length_derived_quantity() == 1_q_m);