From 660f192722dc1fffa244bcf65945a1795b7367fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 14 May 2019 11:14:30 +0200 Subject: [PATCH] cpp: Fix misuse of std::swap We should not use explicit template arguments, because this disabled SFINAE and forces instantiation of all overloads. --- include/evmc/evmc.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/evmc/evmc.hpp b/include/evmc/evmc.hpp index 2210bae..1ae2d12 100644 --- a/include/evmc/evmc.hpp +++ b/include/evmc/evmc.hpp @@ -56,8 +56,8 @@ public: /// releases the ownership of the resources and invalidates this object. evmc_result raw() noexcept { - auto out = evmc_result{}; - std::swap(out, *this); + const auto out = evmc_result{*this}; // Copy data. + this->release = nullptr; // Disable releasing of this object. return out; } };