diff --git a/common/main/d_array.h b/common/main/d_array.h index 1c5f4b1a5..24e4ba918 100644 --- a/common/main/d_array.h +++ b/common/main/d_array.h @@ -24,6 +24,16 @@ namespace dcx { * Other types for E are not likely to be useful, but are not blocked. */ template +/* `std::size_t` is `unsigned` on i686-w64-mingw32, and `unsigned long` on + * x86_64-pc-linux-gnu. + * + * As a result, if `E` is `unsigned`, then i686-w64-mingw32 breaks due to + * `operator[](E)` and `operator[](std::size_t)` being the same signature. If + * `E` is `unsigned long`, then x86_64-pc-linux-gnu breaks for the same reason. + * Disallow both `unsigned` and `unsigned long`, so that any attempt to use + * either for `E` will break everywhere, rather than breaking only some + * platforms. + */ requires(!std::is_same::value && !std::is_same::value) struct enumerated_array : std::array { @@ -47,7 +57,9 @@ struct enumerated_array : std::array { return this->base_type::operator[](static_cast(position)); } - const_reference operator[](std::size_t) const = delete; + template + requires(std::is_integral_v) + const_reference operator[](I) const = delete; [[nodiscard]] static constexpr bool valid_index(std::size_t s) {