facebook/folly

A problem related to std::array being undefined when compiling Folly

Closed this issue · 0 comments

Hi , we are MSVC testing team.
When compiling Folly, I encountered a problem related to std::array being undefined, which caused the FixedMergingCancellationState template class in CancellationToken-inl.h to fail to be instantiated correctly.

C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\cl.exe  /nologo /TP -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_CHRONO_NO_LIB -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE -DBOOST_CONTAINER_DYN_LINK -DBOOST_CONTAINER_NO_LIB -DBOOST_CONTEXT_DYN_LINK="" -DBOOST_CONTEXT_EXPORT=EXPORT -DBOOST_CONTEXT_NO_LIB="" -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DBOOST_THREAD_USE_DLL -DFMT_SHARED -DFOLLY_XLOG_STRIP_PREFIXES=\"C:/gitP/facebook/folly:C:/gitP/facebook/folly/build_amd64\" -DGFLAGS_IS_A_DLL=1 -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DWIN32_LEAN_AND_MEAN -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_SCL_SECURE_NO_WARNINGS -D_STL_EXTRA_DISABLED_WARNINGS="4774 4987" -IC:\gitP\facebook\folly -IC:\gitP\facebook\folly\build_amd64 -external:IC:\gitP\Microsoft\vcpkg\installed\x64-windows\include -external:W0 /DWIN32 /D_WINDOWS /W3 /GR  /MD /O2 /Ob2 /DNDEBUG -std:c++17 /EHs /GF /Zc:referenceBinding /Zc:rvalueCast /Zc:implicitNoexcept /Zc:strictStrings /Zc:threadSafeInit /Zc:throwingNew /permissive- /std:c++17 /bigobj /favor:blend /Zc:inline /Wall /MP /Gw /Gy /Qpar /Oi /Ot /wd4191 /wd4291 /wd4309 /wd4310 /wd4366 /wd4587 /wd4592 /wd4628 /wd4723 /wd4724 /wd4868 /wd4996 /wd4068 /wd4091 /wd4146 /wd4800 /wd4018 /wd4365 /wd4388 /wd4389 /wd4100 /wd4459 /wd4505 /wd4701 /wd4702 /wd4061 /wd4127 /wd4200 /wd4201 /wd4296 /wd4316 /wd4324 /wd4355 /wd4371 /wd4435 /wd4514 /wd4548 /wd4571 /wd4574 /wd4582 /wd4583 /wd4619 /wd4623 /wd4625 /wd4626 /wd4643 /wd4647 /wd4668 /wd4706 /wd4710 /wd4711 /wd4714 /wd4820 /wd5026 /wd5027 /wd5031 /wd5045 /we4099 /we4129 /we4566 /utf-8 /showIncludes /FoCMakeFiles\cancellation_token_test.dir\folly\test\CancellationTokenTest.cpp.obj /FdCMakeFiles\cancellation_token_test.dir\ /FS -c C:\gitP\facebook\folly\folly\test\CancellationTokenTest.cpp
C:\gitP\facebook\folly\folly/CancellationToken-inl.h(117): error C2079: 'folly::detail::FixedMergingCancellationState<2>::callbacks_' uses undefined class 'std::array<folly::CancellationCallback,2>'
C:\gitP\facebook\folly\folly/CancellationToken-inl.h(117): note: the template instantiation context (the oldest one first) is
C:\gitP\facebook\folly\folly\test\CancellationTokenTest.cpp(268): note: see reference to function template instantiation 'folly::CancellationToken folly::CancellationToken::merge<folly::CancellationToken,folly::CancellationToken>(folly::CancellationToken &&,folly::CancellationToken &&)' being compiled
C:\gitP\facebook\folly\folly/CancellationToken-inl.h(444): note: see reference to class template instantiation 'folly::detail::FixedMergingCancellationState<2>' being compiled

I think the use of std::array in your code may result in compilation errors , especially if the array size is 0 . Could you please take a look? For more error information, please see the attachment. we using Microsoft C/C++ Optimizing Compiler Version 19.42.34405.97.
Build.log