electronicarts/EASTL

[MSVC][std:c++latest] EASTL build failed due to error C2666: 'TestLruCacheInternal::Foo::operator ==': overloaded functions have similar conversions

Zhaojun-Liu opened this issue · 2 comments

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 the operator== https://github.com/electronicarts/EASTL/blob/master/test/source/TestLruCache.cpp#L25 here needs a 'const'. Could you please look this issue? Thanks.

F:\gitP\electronicarts\EASTL\test\source\TestLruCache.cpp(157,3): error C2666: 'TestLruCacheInternal::Foo::operator ==': overloaded functions have similar conversions [F:\gitP\electronicarts\EASTL\build_amd64\test\EASTLTest.vcxproj]
         TestRandom.cpp
       F:\gitP\electronicarts\EASTL\test\source\TestLruCache.cpp(25,8): message : could be 'bool TestLruCacheInternal::Foo::operator ==(const TestLruCacheInternal::Foo &)' [F:\gitP\electronicarts\EASTL\build_amd64\test\EASTLTest.vcxproj]

Note: this issue will be reproduced on next release version of VS(VS17.6 or later)

Repro steps:

  1. open VS2019 x64 tools command
  2. git clone https://github.com/electronicarts/EASTL F:\gitP\electronicarts\EASTL
  3. cd F:\gitP\electronicarts\EASTL
  4. mkdir build_amd64 & cd build_amd64
  5. set CL= /std:c++latest
  6. cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DEASTL_BUILD_TESTS:BOOL=ON -DEASTL_BUILD_BENCHMARK:BOOL=OFF ..
  7. set CL=%CL% /Zc:static_assert- /Zc:char8_t-
  8. msbuild /m /p:Platform=x64 /p:Configuration=Release EASTL.sln /t:Rebuild

Detailed log:
build.log

Thanks for the heads up.

I'm on an older VS version so I was unable to repro this but I've added the const there, seems like a simple enough fix.

Thanks for the heads up.

I'm on an older VS version so I was unable to repro this but I've added the const there, seems like a simple enough fix.

Thanks for the fix. 😃