When upgrading {fmt}
, b4d1d7f8e broke some of our usage. We had a place where we were building up a format string using a type like this:
template <size_t N> struct fixed_string { char data[N] = {}; constexpr fixed_string(char const (&m)[N]) { for (size_t i = 0; i != N; ++i) { data[i] = m[i]; } } };
And trying to do something like:
static constexpr auto f = fixed_string("x={}"); fmt::print(f.data, 42);
This works on fmt 10.2.1 and 11.0, fails on trunk — after that commit, with:
/opt/compiler-explorer/libs/fmt/trunk/include/fmt/base.h:543:31: error: '__builtin_strlen(((const char*)(& f.fixed_string<5>::data)))' is not a constant expression 543 | size_ = __builtin_strlen(detail::narrow(s)); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
gcc says that __builtin_strlen
isn't usable like this. Which... if they say so. But seems unlikely this will change, so I think {fmt}
should also revert to previous usage.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4