From 33837c5042720300b05f2d50299f117f80fa34b5 Mon Sep 17 00:00:00 2001 From: Jonas Hoppe <162709928+czjhoppe@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:43:57 +0200 Subject: [PATCH] [msvc][fix] some short names hide global identifier --- example/glide_computer.cpp | 10 ++++----- .../mp-units/framework/dimension_concepts.h | 2 +- .../framework/quantity_point_concepts.h | 6 ++--- .../mp-units/framework/quantity_spec.h | 22 +++++++++---------- .../framework/quantity_spec_concepts.h | 2 +- .../include/mp-units/framework/symbol_text.h | 4 ++-- src/core/include/mp-units/framework/unit.h | 8 +++---- test/static/quantity_test.cpp | 4 ++-- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/example/glide_computer.cpp b/example/glide_computer.cpp index 133a7713..f06062fe 100644 --- a/example/glide_computer.cpp +++ b/example/glide_computer.cpp @@ -169,7 +169,7 @@ void example() const auto gliders = get_gliders(); const auto waypoints = get_waypoints(); const auto weather_conditions = get_weather_conditions(); - const task t = {waypoints[0], waypoints[1], waypoints[0]}; + const task glider_task = {waypoints[0], waypoints[1], waypoints[0]}; const aircraft_tow tow = {400 * m, 1.6 * m / s}; const timestamp start_time(std::chrono::system_clock::now()); @@ -177,16 +177,16 @@ void example() print(gliders); print(waypoints); print(weather_conditions); - print(t); + print(glider_task); print(tow); - for (const auto& g : gliders) { + for (const auto& glider : gliders) { for (const auto& c : weather_conditions) { - const std::string txt = "Scenario: Glider = " + g.name + ", Weather = " + c.first; + const std::string txt = "Scenario: Glider = " + glider.name + ", Weather = " + c.first; std::cout << txt << "\n"; std::cout << MP_UNITS_STD_FMT::format("{0:=^{1}}\n\n", "", txt.size()); - estimate(start_time, g, c.second, t, sfty, tow); + estimate(start_time, glider, c.second, glider_task, sfty, tow); std::cout << "\n\n"; } diff --git a/src/core/include/mp-units/framework/dimension_concepts.h b/src/core/include/mp-units/framework/dimension_concepts.h index 7517ea7f..b5225399 100644 --- a/src/core/include/mp-units/framework/dimension_concepts.h +++ b/src/core/include/mp-units/framework/dimension_concepts.h @@ -54,7 +54,7 @@ void to_base_specialization_of_base_dimension(const volatile base_dimension inline constexpr bool is_derived_from_specialization_of_base_dimension = - requires(T* t) { to_base_specialization_of_base_dimension(t); }; + requires(T* type) { to_base_specialization_of_base_dimension(type); }; /** * @brief A concept matching all named base dimensions in the library. diff --git a/src/core/include/mp-units/framework/quantity_point_concepts.h b/src/core/include/mp-units/framework/quantity_point_concepts.h index a262ea7d..bd8cb5b2 100644 --- a/src/core/include/mp-units/framework/quantity_point_concepts.h +++ b/src/core/include/mp-units/framework/quantity_point_concepts.h @@ -45,7 +45,7 @@ void to_base_specialization_of_absolute_point_origin(const volatile absolute_poi template inline constexpr bool is_derived_from_specialization_of_absolute_point_origin = - requires(T* t) { to_base_specialization_of_absolute_point_origin(t); }; + requires(T* type) { to_base_specialization_of_absolute_point_origin(type); }; } // namespace detail @@ -67,7 +67,7 @@ void to_base_specialization_of_relative_point_origin(const volatile relative_poi template inline constexpr bool is_derived_from_specialization_of_relative_point_origin = - requires(T* t) { to_base_specialization_of_relative_point_origin(t); }; + requires(T* type) { to_base_specialization_of_relative_point_origin(type); }; struct point_origin_interface; @@ -100,7 +100,7 @@ void to_base_specialization_of_quantity_point(const volatile quantity_point inline constexpr bool is_derived_from_specialization_of_quantity_point = - requires(T* t) { to_base_specialization_of_quantity_point(t); }; + requires(T* type) { to_base_specialization_of_quantity_point(type); }; template requires is_derived_from_specialization_of_quantity_point diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index 88eec204..94bce96a 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -765,14 +765,14 @@ template, type_list) { constexpr auto n = get_complexity(Num{}); - constexpr auto d = get_complexity(Den{}); - constexpr auto max_compl = n > d ? n : d; + constexpr auto den = get_complexity(Den{}); + constexpr auto max_compl = n > den ? n : den; - if constexpr (max_compl == Complexity || ((n >= d && !requires { explode_to_equation(Num{}); }) || - (n < d && !requires { explode_to_equation(Den{}); }))) + if constexpr (max_compl == Complexity || ((n >= den && !requires { explode_to_equation(Num{}); }) || + (n < den && !requires { explode_to_equation(Den{}); }))) return explode_result{(map_power(Num{}) * ... * map_power(Nums{})) / (map_power(Den{}) * ... * map_power(Dens{}))}; else { - if constexpr (n >= d) { + if constexpr (n >= den) { constexpr auto res = explode_to_equation(Num{}); return explode((res.equation * ... * map_power(Nums{})) / (map_power(Den{}) * ... * map_power(Dens{}))) @@ -801,8 +801,8 @@ template template [[nodiscard]] consteval auto explode(Q, type_list<>, type_list) { - constexpr auto d = get_complexity(Den{}); - if constexpr (d == Complexity || !requires { explode_to_equation(Den{}); }) + constexpr auto den = get_complexity(Den{}); + if constexpr (den == Complexity || !requires { explode_to_equation(Den{}); }) return explode_result{dimensionless / (map_power(Den{}) * ... * map_power(Dens{}))}; else { constexpr auto res = explode_to_equation(Den{}); @@ -820,8 +820,8 @@ template template [[nodiscard]] consteval auto explode(Q q) { - constexpr auto c = get_complexity(Q{}); - if constexpr (c > Complexity) + constexpr auto complexity = get_complexity(Q{}); + if constexpr (complexity > Complexity) return explode(q, type_list_sort{}, type_list_sort{}); else @@ -831,8 +831,8 @@ template template [[nodiscard]] consteval auto explode(Q q) { - constexpr auto c = get_complexity(Q{}); - if constexpr (c > Complexity && requires { Q::_equation_; }) { + constexpr auto complexity = get_complexity(Q{}); + if constexpr (complexity > Complexity && requires { Q::_equation_; }) { constexpr auto res = explode_to_equation(Q{}); return explode(res.equation).common_convertibility_with(res); } else diff --git a/src/core/include/mp-units/framework/quantity_spec_concepts.h b/src/core/include/mp-units/framework/quantity_spec_concepts.h index 9eac9f2d..054742f0 100644 --- a/src/core/include/mp-units/framework/quantity_spec_concepts.h +++ b/src/core/include/mp-units/framework/quantity_spec_concepts.h @@ -71,7 +71,7 @@ void to_base_specialization_of_quantity_spec(const volatile quantity_spec inline constexpr bool is_derived_from_specialization_of_quantity_spec = - requires(T* t) { to_base_specialization_of_quantity_spec(t); }; + requires(T* type) { to_base_specialization_of_quantity_spec(type); }; /** * @brief Concept matching all named quantity specification types diff --git a/src/core/include/mp-units/framework/symbol_text.h b/src/core/include/mp-units/framework/symbol_text.h index f0a75313..d2875821 100644 --- a/src/core/include/mp-units/framework/symbol_text.h +++ b/src/core/include/mp-units/framework/symbol_text.h @@ -128,9 +128,9 @@ public: MP_UNITS_EXPECTS(detail::is_basic_literal_character_set(a)); } - constexpr symbol_text(const fixed_u8string& u, const fixed_string& a) : unicode_(u), ascii_(a) + constexpr symbol_text(const fixed_u8string& u, const fixed_string& text) : unicode_(u), ascii_(text) { - MP_UNITS_EXPECTS(detail::is_basic_literal_character_set(a.data_)); + MP_UNITS_EXPECTS(detail::is_basic_literal_character_set(text.data_)); } [[nodiscard]] constexpr const auto& unicode() const { return unicode_; } diff --git a/src/core/include/mp-units/framework/unit.h b/src/core/include/mp-units/framework/unit.h index 411f3256..f6a52e4f 100644 --- a/src/core/include/mp-units/framework/unit.h +++ b/src/core/include/mp-units/framework/unit.h @@ -520,9 +520,9 @@ template template [[nodiscard]] consteval auto get_canonical_unit_impl(const type_list&) { - auto m = (mp_units::mag<1> * ... * get_canonical_unit_impl(Us{}, Us{}).mag); + auto magnitude = (mp_units::mag<1> * ... * get_canonical_unit_impl(Us{}, Us{}).mag); auto u = (one * ... * get_canonical_unit_impl(Us{}, Us{}).reference_unit); - return canonical_unit{m, u}; + return canonical_unit{magnitude, u}; } template @@ -654,8 +654,8 @@ template else if constexpr (is_integral(canonical_rhs.mag / canonical_lhs.mag)) return u1; else { - constexpr auto cm = detail::common_magnitude(canonical_lhs.mag, canonical_rhs.mag); - return scaled_unit{}; + constexpr auto common_magnitude = detail::common_magnitude(canonical_lhs.mag, canonical_rhs.mag); + return scaled_unit{}; } } } diff --git a/test/static/quantity_test.cpp b/test/static/quantity_test.cpp index d8ddfe60..7fcabec2 100644 --- a/test/static/quantity_test.cpp +++ b/test/static/quantity_test.cpp @@ -311,9 +311,9 @@ struct derived_quantity : quantity { R::operator=(t); return *this; } - constexpr derived_quantity& operator=(R&& t) + constexpr derived_quantity& operator=(R&& other) { - R::operator=(std::move(t)); + R::operator=(std::move(other)); return *this; } // NOLINTBEGIN(google-explicit-constructor, hicpp-explicit-conversions)