Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/core/include/mp-units/bits/hacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/core/include/mp-units/framework/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ struct propagate_point_origin<U, true> {
};

template<UnitMagnitude auto M, Unit U>
struct scaled_unit_impl : detail::unit_interface, detail::propagate_point_origin<U> {
struct MP_UNITS_EMPTY_BASES_WORKAROUND scaled_unit_impl : detail::unit_interface, detail::propagate_point_origin<U> {
using _base_type_ = scaled_unit_impl; // exposition only
static constexpr UnitMagnitude auto _mag_ = M;
static constexpr U _reference_unit_{};
Expand Down Expand Up @@ -461,7 +461,9 @@ struct common_unit final : decltype(detail::get_common_scaled_unit(U1{}, U2{}, R
namespace detail {

template<typename... Expr>
struct derived_unit_impl : detail::unit_interface, detail::expr_fractions<one, Expr...> {
struct MP_UNITS_EMPTY_BASES_WORKAROUND derived_unit_impl :
detail::unit_interface,
detail::expr_fractions<one, Expr...> {
using _base_type_ = derived_unit_impl; // exposition only
};

Expand Down