From 6f84a9df609bb7d4ae8be1c94e8f6fbf1e670ef1 Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Wed, 23 Jun 2021 11:53:40 -0700 Subject: [PATCH] Fix function signature of binary +/- operator to not return a reference (#1523) This function creates a new object on the stack, and was returning it as a reference. This would trigger Clang 12's `-Wreturn-stack-address` warning, and cause the build to fail. This is a cherry-pick from #1285 --- Code/CryEngine/CryCommon/ISystem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/CryEngine/CryCommon/ISystem.h b/Code/CryEngine/CryCommon/ISystem.h index 67128ef7d7..1a2ffc5a7c 100644 --- a/Code/CryEngine/CryCommon/ISystem.h +++ b/Code/CryEngine/CryCommon/ISystem.h @@ -1149,13 +1149,13 @@ struct DiskOperationInfo return *this; } - DiskOperationInfo& operator - (const DiskOperationInfo& rv) + DiskOperationInfo operator - (const DiskOperationInfo& rv) { DiskOperationInfo res(*this); return res -= rv; } - DiskOperationInfo& operator + (const DiskOperationInfo& rv) + DiskOperationInfo operator + (const DiskOperationInfo& rv) { DiskOperationInfo res(*this); return res += rv;