Skip to content

Commit 2abaa8a

Browse files
committed
Fix bug re: return type of f(un)lockfile wrappers for Windows
Just a tiny bugfix I spotted: The `f(un)lockfile` wrappers in `format-inl.h` that wrap Windows's `_(un)lock_file` methods are defined with a trailing return type derived by using decltype on a hypothetical call to the underlying functions. The wrappers don't contain a `return` in their bodies, however, so if the return type of the underlying functions were to ever change from `void`, there would be a compile error. IIRC, the ability to write `return [other function returning void]();` in a function returning void is a new-ish addition to the standard (no idea when). Since these functions aren't public-facing, and no library code ever attempts to use their return values, I opted to just declare them `void` instead of adding `return`s.
1 parent 9396f77 commit 2abaa8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/fmt/format-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,10 +1476,10 @@ template <typename T> struct span {
14761476
size_t size;
14771477
};
14781478

1479-
template <typename F> auto flockfile(F* f) -> decltype(_lock_file(f)) {
1479+
template <typename F> void flockfile(F* f) {
14801480
_lock_file(f);
14811481
}
1482-
template <typename F> auto funlockfile(F* f) -> decltype(_unlock_file(f)) {
1482+
template <typename F> void funlockfile(F* f) {
14831483
_unlock_file(f);
14841484
}
14851485

0 commit comments

Comments
 (0)