Skip to content

Commit 8bc3be2

Browse files
committed
fix: gcc-15 workaround
Resolves #702
1 parent e2f11cd commit 8bc3be2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/include/mp-units/format.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ constexpr It format_global_buffer(It out, const fill_align_width_format_specs<Ch
105105

106106
MP_UNITS_EXPORT_END
107107

108+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120625
109+
template<typename T>
110+
inline constexpr bool GCC_120625_is_complete = requires { sizeof(T) > 0; };
111+
108112
} // namespace mp_units::detail
109113

110114
//
@@ -114,7 +118,8 @@ MP_UNITS_EXPORT_END
114118
// dimension-spec = [character-set];
115119
// character-set = 'U' | 'P';
116120
//
117-
template<mp_units::Dimension D, typename Char>
121+
template<typename D, typename Char>
122+
requires mp_units::detail::GCC_120625_is_complete<D> && mp_units::Dimension<D>
118123
class MP_UNITS_STD_FMT::formatter<D, Char> {
119124
struct format_specs : mp_units::detail::fill_align_width_format_specs<Char>, mp_units::dimension_symbol_formatting {};
120125
format_specs specs_{};
@@ -186,7 +191,8 @@ class MP_UNITS_STD_FMT::formatter<D, Char> {
186191
// unit-symbol-solidus = '1' | 'a' | 'n';
187192
// unit-symbol-separator = 's' | 'd';
188193
//
189-
template<mp_units::Unit U, typename Char>
194+
template<typename U, typename Char>
195+
requires mp_units::detail::GCC_120625_is_complete<U> && mp_units::Unit<U>
190196
class MP_UNITS_STD_FMT::formatter<U, Char> {
191197
struct format_specs : mp_units::detail::fill_align_width_format_specs<Char>, mp_units::unit_symbol_formatting {};
192198
format_specs specs_{};

0 commit comments

Comments
 (0)