Croteam-official / Serious-Engine

An open source version of a game engine developed by Croteam for the classic Serious Sam games.
GNU General Public License v2.0
3.05k stars 368 forks source link

[MSVC][std:c++latest] Serious_Engine build failed due to error C2666: 'CValuesForPrimitive::operator ==': overloaded functions have similar conversions #55

Open fangzhouxia opened 1 year ago

fangzhouxia commented 1 year ago

Description: After the MSVC team implented P2468R2 The Equality Operator You Are Looking For, we got a compiler error with /std:c++latest like below, the error is due to operator here https://github.com/Croteam-official/Serious-Engine/blob/master/Sources/WorldEditor/WorldEditor.h#L188 and https://github.com/Croteam-official/Serious-Engine/blob/master/Sources/WorldEditor/WorldEditor.h#L577 here needs a 'const'. Could you please look this issue? Thanks.

Reproduction steps:

  1. open VS2019 x86 tools command
  2. git clone https://github.com/Croteam-official/Serious-Engine F:\gitP\Croteam-official\Serious-Engine\Sources
  3. set CL=/std:c++latest /permissive
  4. cd F:\gitP\Croteam-official\Serious-Engine\Sources
  5. devenv /upgrade All.sln
  6. msbuild /p:Configuration=Release;Platform=Win32 /p:WindowsTargetPlatformVersion=10.0.18362.0 All.sln /t:Rebuild /m /p:BuildInParallel=true

log: build (3).log F:\gitP\Croteam-official\Serious-Engine\Sources\WorldEditor\DlgPgPrimitive.cpp(393): error C2666: 'CValuesForPrimitive::operator ==': overloaded functions have similar conversions F:\gitP\Croteam-official\Serious-Engine\Sources\WorldEditor\WorldEditor.h(577): note: could be 'BOOL CValuesForPrimitive::operator ==(const CValuesForPrimitive &)' F:\gitP\Croteam-official\Serious-Engine\Sources\Engine\Base\CTString.h(83): note: or 'BOOL operator ==(const char *,const CTString &)' C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\d2d1helper.h(1024): note: or 'bool operator ==(const D2D1_RECT_U &,const D2D1_RECT_U &)' C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\d2d1helper.h(1016): note: or 'bool operator ==(const D2D1_SIZE_U &,const D2D1_SIZE_U &)' C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\propkeydef.h(35): note: or 'int operator ==(const PROPERTYKEY &,const PROPERTYKEY &)' C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\guiddef.h(192): note: or 'bool operator ==(const GUID &,const GUID &)'