vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx | 35 ++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
New commits: commit 71ff8ea36e365c364aedce83dd6f9f3b8db69f5d Author: Milian Wolff <milian.wo...@kdab.com> Date: Tue Jan 30 11:16:00 2018 +0100 Fix compilation with GCC 4.8 Workaround a bug in variadic template parameter pack expansion in lambdas that affects GCC <= 4.8 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55914). The workaround expands the pack outside the lambda into a custom functor that then calls readIpcArgs. Change-Id: I7a2d8572a6f2b330bb22a4f18f5cc13fd7ef9b45 diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx index a1877d617420..a6b6f9098300 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx @@ -71,10 +71,43 @@ public: std::string readResponseLine(); + // workaround gcc <= 4.8 bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55914 + template <int...> struct seq + { + }; + template <int N, int... S> struct gens : gens<N - 1, N - 1, S...> + { + }; + template <int... S> struct gens<0, S...> + { + typedef seq<S...> type; + }; + template <typename... Args> struct ArgsReader + { + ArgsReader(Args&... args) + : m_args(args...) + { + } + + void operator()(std::istream& stream) + { + callFunc(stream, typename gens<sizeof...(Args)>::type()); + } + + private: + template <int... S> void callFunc(std::istream& stream, seq<S...>) + { + readIpcArgs(stream, std::get<S>(m_args)...); + } + + std::tuple<Args&...> m_args; + }; + template <typename... Args> void readResponse(uint64_t id, Args&... args) { // read synchronously from a background thread and run the eventloop until the value becomes available // this allows us to keep the GUI responsive and also enables access to the LO clipboard + ArgsReader<Args...> argsReader(args...); await(std::async(std::launch::async, [&]() { while (true) { @@ -91,7 +124,7 @@ public: if (m_incomingResponse == id) { // the response we are waiting for came in - readIpcArgs(m_responseStream, args...); + argsReader(m_responseStream); m_incomingResponse = 0; break; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits