electronicarts / EASTL

EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.
BSD 3-Clause "New" or "Revised" License
7.82k stars 905 forks source link

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

Closed Zhaojun-Liu closed 1 year ago

Zhaojun-Liu 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 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

grojo-ea commented 1 year ago

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.

Zhaojun-Liu commented 1 year ago

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. 😃