From 6d92f7109f9e15302a17fe7dbd5e8f9ef3bb4993 Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Mon, 14 Jun 2021 08:09:28 -0700 Subject: [PATCH] Fix function signature of binary +/- operator to not return a reference (#1285) 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 fixes builds with clang 12, so it closes #591 --- 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 653776f55b..bb4c320439 100644 --- a/Code/CryEngine/CryCommon/ISystem.h +++ b/Code/CryEngine/CryCommon/ISystem.h @@ -1154,13 +1154,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;