From 87a7451c2a9e0e5cf9334f2a77272ffda4632f56 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 4 Jun 2024 15:25:25 +0200 Subject: [PATCH] LayoutBuilder: Fix build with Apple Clang It needs an explicit constructor, otherwise it complains that it cannot find a match to the Arg2{p1, p2} call (requires 1 argument, but 2 were provided) etc. Amends 6231213aa3dad4652b46507183793180cd5bb7ee Change-Id: Ibe3b27b334b8abff5028a77372cf208bfda9d8c1 Reviewed-by: hjk --- src/libs/utils/layoutbuilder.h | 44 ++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/src/libs/utils/layoutbuilder.h b/src/libs/utils/layoutbuilder.h index 17fa24e0f42..eb516cecc88 100644 --- a/src/libs/utils/layoutbuilder.h +++ b/src/libs/utils/layoutbuilder.h @@ -50,14 +50,44 @@ public: const T2 arg; // FIXME: Could be const &, but this would currently break bindTo(). }; -template -struct Arg2 { const T1 p1; const T2 p2; }; +template +struct Arg2 +{ + Arg2(const T1 &a1, const T2 &a2) + : p1(a1) + , p2(a2) + {} + const T1 p1; + const T2 p2; +}; -template -struct Arg3 { const T1 p1; const T2 p2; const T3 p3; }; +template +struct Arg3 +{ + Arg3(const T1 &a1, const T2 &a2, const T3 &a3) + : p1(a1) + , p2(a2) + , p3(a3) + {} + const T1 p1; + const T2 p2; + const T3 p3; +}; -template -struct Arg4 { const T1 p1; const T2 p2; const T3 p3; const T4 p4; }; +template +struct Arg4 +{ + Arg4(const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4) + : p1(a1) + , p2(a2) + , p3(a3) + , p4(a4) + {} + const T1 p1; + const T2 p2; + const T3 p3; + const T4 p4; +}; // The main dispatcher @@ -460,7 +490,7 @@ void doit(Interface *x, IdId, auto p) #define QTCREATOR_SETTER3(name, setter) \ class name##_TAG {}; \ - inline auto name(auto p1, auto p2, auto p3) { return IdAndArg{name##_TAG{}, Arg4{p1, p2, p3}}; } \ + inline auto name(auto p1, auto p2, auto p3) { return IdAndArg{name##_TAG{}, Arg3{p1, p2, p3}}; } \ inline void doit(auto x, name##_TAG, auto p) { x->setter(p.p1, p.p2, p.p3); } #define QTCREATOR_SETTER4(name, setter) \