diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 21ea84dbf..f8fe6a59c 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -273,7 +273,7 @@ Derivation parseDerivation(const Store & store, std::string && s, std::string_vi static void printString(string & res, std::string_view s) { size_t bufSize = s.size() * 2 + 2; - withBuffer(bufSize, [&](char buf[]) { + withBuffer(bufSize, [&](char *buf) { char * p = buf; *p++ = '"'; for (auto c : s) diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 840acd67b..407505be9 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -671,7 +671,10 @@ template overloaded(Ts...) -> overloaded; std::string showBytes(uint64_t bytes); -template inline R withBuffer(size_t size, std::function fun) { +template +inline auto withBuffer(size_t size, Fn fun) + -> std::invoke_result_t +{ if (size < 0x10000) { T buf[size]; return fun(buf);