diff --git a/src/core/include/mp-units/bits/hacks.h b/src/core/include/mp-units/bits/hacks.h index 7a894c337..ef05d7820 100644 --- a/src/core/include/mp-units/bits/hacks.h +++ b/src/core/include/mp-units/bits/hacks.h @@ -146,6 +146,16 @@ MP_UNITS_DIAGNOSTIC_POP #endif +#if MP_UNITS_COMP_MSVC + +#define MP_UNITS_EMPTY_BASES_WORKAROUND __declspec(empty_bases) + +#else + +#define MP_UNITS_EMPTY_BASES_WORKAROUND + +#endif + #if !defined MP_UNITS_API_NO_CRTP && __cpp_explicit_this_parameter #define MP_UNITS_API_NO_CRTP 1 diff --git a/src/core/include/mp-units/framework/unit.h b/src/core/include/mp-units/framework/unit.h index cd1d9eda1..68475a312 100644 --- a/src/core/include/mp-units/framework/unit.h +++ b/src/core/include/mp-units/framework/unit.h @@ -226,7 +226,7 @@ struct propagate_point_origin { }; template -struct scaled_unit_impl : detail::unit_interface, detail::propagate_point_origin { +struct MP_UNITS_EMPTY_BASES_WORKAROUND scaled_unit_impl : detail::unit_interface, detail::propagate_point_origin { using _base_type_ = scaled_unit_impl; // exposition only static constexpr UnitMagnitude auto _mag_ = M; static constexpr U _reference_unit_{}; @@ -461,7 +461,9 @@ struct common_unit final : decltype(detail::get_common_scaled_unit(U1{}, U2{}, R namespace detail { template -struct derived_unit_impl : detail::unit_interface, detail::expr_fractions { +struct MP_UNITS_EMPTY_BASES_WORKAROUND derived_unit_impl : + detail::unit_interface, + detail::expr_fractions { using _base_type_ = derived_unit_impl; // exposition only };