diff --git a/src/core/include/mp-units/framework/dimension.h b/src/core/include/mp-units/framework/dimension.h index d4a17ba2a..b0ff804f6 100644 --- a/src/core/include/mp-units/framework/dimension.h +++ b/src/core/include/mp-units/framework/dimension.h @@ -220,13 +220,18 @@ template [[nodiscard]] consteval Dimension auto cbrt(Dimension auto d) { return pow<1, 3>(d); } -MP_UNITS_DIAGNOSTIC_PUSH -MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED struct dimension_symbol_formatting { +#if MP_UNITS_COMP_CLANG + // TODO prevents the deprecated usage in implicit copy constructor warning + character_set char_set = character_set::default_character_set; +#else [[deprecated("Use `char_set` instead")]] character_set encoding = character_set::default_character_set; + MP_UNITS_DIAGNOSTIC_PUSH + MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED character_set char_set = encoding; + MP_UNITS_DIAGNOSTIC_POP +#endif }; -MP_UNITS_DIAGNOSTIC_POP MP_UNITS_EXPORT_END diff --git a/src/core/include/mp-units/framework/unit_symbol_formatting.h b/src/core/include/mp-units/framework/unit_symbol_formatting.h index f264343be..04e4954f8 100644 --- a/src/core/include/mp-units/framework/unit_symbol_formatting.h +++ b/src/core/include/mp-units/framework/unit_symbol_formatting.h @@ -53,15 +53,20 @@ enum class unit_symbol_separator : std::int8_t { default_separator = space }; -MP_UNITS_DIAGNOSTIC_PUSH -MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED struct unit_symbol_formatting { +#if MP_UNITS_COMP_CLANG + // TODO prevents the deprecated usage in implicit copy constructor warning + character_set char_set = character_set::default_character_set; +#else [[deprecated("Use `char_set` instead")]] character_set encoding = character_set::default_character_set; + MP_UNITS_DIAGNOSTIC_PUSH + MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED character_set char_set = encoding; + MP_UNITS_DIAGNOSTIC_POP +#endif unit_symbol_solidus solidus = unit_symbol_solidus::default_denominator; unit_symbol_separator separator = unit_symbol_separator::default_separator; }; -MP_UNITS_DIAGNOSTIC_POP } // namespace mp_units diff --git a/test/runtime/fmt_test.cpp b/test/runtime/fmt_test.cpp index a163c1877..ebce5ad9e 100644 --- a/test/runtime/fmt_test.cpp +++ b/test/runtime/fmt_test.cpp @@ -55,7 +55,7 @@ using v = cartesian_vector; TEST_CASE("dimension_symbol", "[dimension][symbol]") { - using enum text_encoding; + using enum character_set; std::ostringstream os; @@ -67,14 +67,14 @@ TEST_CASE("dimension_symbol", "[dimension][symbol]") SECTION("Portable mode") { - os << dimension_symbol(isq::power.dimension); + os << dimension_symbol(isq::power.dimension); CHECK(os.str() == "L^2MT^-3"); } } TEST_CASE("unit_symbol", "[unit][symbol]") { - using enum text_encoding; + using enum character_set; using enum unit_symbol_solidus; using enum unit_symbol_separator; @@ -88,7 +88,7 @@ TEST_CASE("unit_symbol", "[unit][symbol]") SECTION("Portable mode") { - os << unit_symbol(m / s2); + os << unit_symbol(m / s2); CHECK(os.str() == "m/s^2"); }