Fixes issue #3839
An Eigen 3.4 2x2 matrix has a begin member function that returns void
Be more strict checking that the result of calling *begin() is valid
See input_or_output_iterator concept notes about void
base::format does not accept rvalues, using the result of format_as
directly means it is passed one. Doesn't matter for ranges with a const
begin and end, but filter_view caches, so it only has mutable begin/end.
Use auto&& to avoid copy if format_as returns const ref
When building `format.cc` as such with GCC 13.2.1:
$ g++ -c format.cc -DFMT_EXCEPTIONS=0 -Wmissing-noreturn -Werror
I get:
In file included from format.cc:8:
fmt/format-inl.h: In function ‘void fmt::v10::detail::assert_fail(const char*, int, const char*)’:
fmt/format-inl.h:30:15: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
30 | FMT_FUNC void assert_fail(const char* file, int line, const char* message) {
| ^~~~~~~~~~~
fmt/format-inl.h: In function ‘void fmt::v10::report_error(const char*)’:
fmt/format-inl.h:129:15: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
129 | FMT_FUNC void report_error(const char* message) {
| ^~~~~~~~~~~~
cc1plus: all warnings being treated as errors
Note that, with `FMT_EXCEPTIONS` defined to 0:
‣ report_error(const char *) uses FMT_THROW() which expands to calling
assert_fail().
‣ assert_fail() calls std::terminate() which has the `[[noreturn]]`
attribute since C++11 [1].
Therefore, with `FMT_EXCEPTIONS` defined to 0, both assert_fail() and
report_error() need to have the `[[noreturn]]` attribute too (if
available). In other words, `FMT_NORETURN` doesn't depend on
`FMT_EXCEPTIONS`.
Also adding `FMT_NORETURN` to two on_error() functions which call
report_error(const char *).
Other report_error() overloads eventually return, therefore they don't
need `FMT_NORETURN`.
[1]: https://en.cppreference.com/w/cpp/error/terminate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
* implement year_month_day, also changed weekday, day, month, year's formatter to use formatter<std::tm, Char> so they all support the format strings
* support ":L" for month and weekday