From 6d898acc98dc072430d66f63e99b32a9af95af5b Mon Sep 17 00:00:00 2001 From: TuxSH Date: Tue, 6 Nov 2018 17:45:27 +0100 Subject: [PATCH] Fix make_object --- mesosphere/include/mesosphere/core/make_object.hpp | 14 +++++++------- mesosphere/source/test.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mesosphere/include/mesosphere/core/make_object.hpp b/mesosphere/include/mesosphere/core/make_object.hpp index e401a2938..205d35267 100644 --- a/mesosphere/include/mesosphere/core/make_object.hpp +++ b/mesosphere/include/mesosphere/core/make_object.hpp @@ -52,7 +52,7 @@ cleanup: template> * = nullptr, typename ...Args> auto MakeObject(Args&& ...args) { - auto [res, obj] = MakeObjectRaw(std::forward(args)...); + auto [res, obj] = MakeObjectRaw(std::forward(args)...); return std::tuple>{res, SharedPtr{obj}}; } @@ -61,8 +61,8 @@ auto MakeObject(Args&& ...args) { // Bug in type inference? using RetType = std::tuple, SharedPtr>; - auto [res, obj] = MakeObjectRaw(std::forward(args)...); - return res.IsSuccess() ? RetType{res, &obj.GetServer(), &obj.GetClient()} : RetType{res, nullptr, nullptr}; + auto [res, obj] = MakeObjectRaw(std::forward(args)...); + return res.IsSuccess() ? RetType{res, &obj->GetServer(), &obj->GetClient()} : RetType{res, nullptr, nullptr}; } template> * = nullptr, typename ...Args> @@ -72,7 +72,7 @@ auto MakeObjectWithHandle(Args&& ...args) KProcess *currentProcess = cctx.GetCurrentProcess(); KHandleTable &tbl = currentProcess->GetHandleTable(); - auto [res, obj] = MakeObjectRaw(std::forward(args)...); + auto [res, obj] = MakeObjectRaw(std::forward(args)...); if (res.IsFailure()) { return std::tuple{res, Handle{}}; } @@ -87,14 +87,14 @@ auto MakeObjectWithHandle(Args&& ...args) KProcess *currentProcess = cctx.GetCurrentProcess(); KHandleTable &tbl = currentProcess->GetHandleTable(); - auto [res, obj] = MakeObjectRaw(std::forward(args)...); + auto [res, obj] = MakeObjectRaw(std::forward(args)...); if (res.IsFailure()) { return std::tuple{res, Handle{}, Handle{}}; } - auto [res2, serverHandle] = tbl.Generate(&obj.GetServer()); + auto [res2, serverHandle] = tbl.Generate(&obj->GetServer()); if (res2.IsSuccess()) { - auto [res3, clientHandle] = tbl.Generate(&obj.GetClient()); + auto [res3, clientHandle] = tbl.Generate(&obj->GetClient()); if (res3.IsSuccess()) { return std::tuple{res3, serverHandle, clientHandle}; } else { diff --git a/mesosphere/source/test.cpp b/mesosphere/source/test.cpp index 65e907997..ea250c8b8 100644 --- a/mesosphere/source/test.cpp +++ b/mesosphere/source/test.cpp @@ -4,8 +4,8 @@ using namespace mesosphere; int main(void) { - auto obj = MakeObjectRaw(); - (void)obj; + auto [res, h1, h2] = MakeObjectWithHandle(); + (void)res; (void)h1; (void)h2; for(;;); return 0; }