diff --git a/include/fmt/core.h b/include/fmt/core.h index 23d2565e..467fdb86 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -935,11 +935,11 @@ template class buffer { /** Appends data to the end of the buffer. */ template void append(const U* begin, const U* end); - template FMT_CONSTEXPR auto operator[](I index) -> T& { + template FMT_CONSTEXPR auto operator[](Idx index) -> T& { return ptr_[index]; } - template - FMT_CONSTEXPR auto operator[](I index) const -> const T& { + template + FMT_CONSTEXPR auto operator[](Idx index) const -> const T& { return ptr_[index]; } }; diff --git a/test/core-test.cc b/test/core-test.cc index 96cde1ed..c76dc161 100644 --- a/test/core-test.cc +++ b/test/core-test.cc @@ -9,7 +9,9 @@ #include "test-assert.h" // clang-format on +#define I 42 // simulate https://en.cppreference.com/w/c/numeric/complex/I #include "fmt/core.h" +#undef I #include // std::copy_n #include // INT_MAX