HowardHinnant / date

A date and time library based on the C++11/14/17 <chrono> header
Other
3.16k stars 685 forks source link

durations_output.pass.cpp test fails to build on VS 2019 #573

Open rigtorp opened 4 years ago

rigtorp commented 4 years ago

Compiled with /std:c++14 so __cplusplus shoud be 199711L:

2020-04-14T19:28:58.6121126Z   Building Custom Rule D:/a/date/date/CMakeLists.txt
2020-04-14T19:28:58.7016300Z   durations_output.pass.cpp
2020-04-14T19:28:59.3537570Z D:\a\date\date\test\date_test\durations_output.pass.cpp(316,26): error C2127: 'integer': illegal initialization of 'constexpr' entity with a non-constant expression [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3550091Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(4471,17): message : failure was because type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3553773Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2628,6): message : type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type because it has a user-defined destructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3556993Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(4246,3): message : type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type because its data member '_Mypair' is of non-literal type 'std::_Compressed_pair<std::allocator<char>,std::_String_val<std::_Simple_types<_Elem>>,true>' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3559688Z           with
2020-04-14T19:28:59.3559985Z           [
2020-04-14T19:28:59.3567585Z               _Elem=char
2020-04-14T19:28:59.3578791Z           ]
2020-04-14T19:28:59.3588071Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xmemory(1321,10): message : type 'std::_Compressed_pair<std::allocator<char>,std::_String_val<std::_Simple_types<_Elem>>,true>' is not a literal type because its data member '_Myval2' is of non-literal type '_Ty2' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3588445Z           with
2020-04-14T19:28:59.3588931Z           [
2020-04-14T19:28:59.3610481Z               _Elem=char
2020-04-14T19:28:59.3610809Z           ]
2020-04-14T19:28:59.3611050Z           and
2020-04-14T19:28:59.3611360Z           [
2020-04-14T19:28:59.3611813Z               _Ty2=std::_String_val<std::_Simple_types<char>>
2020-04-14T19:28:59.3612250Z           ]
2020-04-14T19:28:59.3613484Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2193,7): message : type 'std::_String_val<std::_Simple_types<_Elem>>' is not a literal type because its data member '_Bx' is of non-literal type 'std::_String_val<std::_Simple_types<_Elem>>::_Bxty' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3613963Z           with
2020-04-14T19:28:59.3614264Z           [
2020-04-14T19:28:59.3614508Z               _Elem=char
2020-04-14T19:28:59.3614799Z           ]
2020-04-14T19:28:59.3615158Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2188,10): message : type 'std::_String_val<std::_Simple_types<_Elem>>::_Bxty' is not a literal type because it has a user-defined destructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3615499Z           with
2020-04-14T19:28:59.3615783Z           [
2020-04-14T19:28:59.3616204Z               _Elem=char
2020-04-14T19:28:59.3616505Z           ]
2020-04-14T19:28:59.3616833Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2185,1): message : type 'std::_String_val<std::_Simple_types<_Elem>>::_Bxty' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3617135Z           with
2020-04-14T19:28:59.3617359Z           [
2020-04-14T19:28:59.3617593Z               _Elem=char
2020-04-14T19:28:59.3617834Z           ]
2020-04-14T19:28:59.3618143Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2211,24): message : type 'std::_String_val<std::_Simple_types<_Elem>>' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3618434Z           with
2020-04-14T19:28:59.3618845Z           [
2020-04-14T19:28:59.3619123Z               _Elem=char
2020-04-14T19:28:59.3619374Z           ]
2020-04-14T19:28:59.3619686Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(4471,17): message : type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3620007Z D:\a\date\date\test\date_test\durations_output.pass.cpp(317,24): error C2127: 'ratio': illegal initialization of 'constexpr' entity with a non-constant expression [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3620337Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(4471,17): message : failure was because type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3620844Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2628,6): message : type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type because it has a user-defined destructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3621368Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(4246,3): message : type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type because its data member '_Mypair' is of non-literal type 'std::_Compressed_pair<std::allocator<char>,std::_String_val<std::_Simple_types<_Elem>>,true>' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3621661Z           with
2020-04-14T19:28:59.3621895Z           [
2020-04-14T19:28:59.3622194Z               _Elem=char
2020-04-14T19:28:59.3622624Z           ]
2020-04-14T19:28:59.3623158Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xmemory(1321,10): message : type 'std::_Compressed_pair<std::allocator<char>,std::_String_val<std::_Simple_types<_Elem>>,true>' is not a literal type because its data member '_Myval2' is of non-literal type '_Ty2' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3623843Z           with
2020-04-14T19:28:59.3624272Z           [
2020-04-14T19:28:59.3624539Z               _Elem=char
2020-04-14T19:28:59.3624796Z           ]
2020-04-14T19:28:59.3625026Z           and
2020-04-14T19:28:59.3625408Z           [
2020-04-14T19:28:59.3625699Z               _Ty2=std::_String_val<std::_Simple_types<char>>
2020-04-14T19:28:59.3625985Z           ]
2020-04-14T19:28:59.3626510Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2193,7): message : type 'std::_String_val<std::_Simple_types<_Elem>>' is not a literal type because its data member '_Bx' is of non-literal type 'std::_String_val<std::_Simple_types<_Elem>>::_Bxty' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3626838Z           with
2020-04-14T19:28:59.3627065Z           [
2020-04-14T19:28:59.3627311Z               _Elem=char
2020-04-14T19:28:59.3627541Z           ]
2020-04-14T19:28:59.3627838Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2188,10): message : type 'std::_String_val<std::_Simple_types<_Elem>>::_Bxty' is not a literal type because it has a user-defined destructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3628144Z           with
2020-04-14T19:28:59.3628753Z           [
2020-04-14T19:28:59.3629228Z               _Elem=char
2020-04-14T19:28:59.3629638Z           ]
2020-04-14T19:28:59.3630186Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2185,1): message : type 'std::_String_val<std::_Simple_types<_Elem>>::_Bxty' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3630724Z           with
2020-04-14T19:28:59.3630969Z           [
2020-04-14T19:28:59.3631241Z               _Elem=char
2020-04-14T19:28:59.3631487Z           ]
2020-04-14T19:28:59.3631814Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(2211,24): message : type 'std::_String_val<std::_Simple_types<_Elem>>' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T19:28:59.3632114Z           with
2020-04-14T19:28:59.3632360Z           [
2020-04-14T19:28:59.3632955Z               _Elem=char
2020-04-14T19:28:59.3633507Z           ]
2020-04-14T19:28:59.3633840Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.25.28610\include\xstring(4471,17): message : type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
HowardHinnant commented 4 years ago

What value does __cplusplus have?

rigtorp commented 4 years ago

Compiled with /std:c++14 /Zc:__cplusplus so __cplusplus shoud be 201402L:

(https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/)

2020-04-14T20:45:59.9476192Z D:\a\date\date\test\date_test\durations_output.pass.cpp(316,62): error C2248: 'date::detail::string_literal<char,5>::string_literal': cannot access private member declared in class 'date::detail::string_literal<char,5>' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9485090Z D:\a\date\date\include\date\date.h(4018): message : see declaration of 'date::detail::string_literal<char,5>::string_literal' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9507366Z D:\a\date\date\include\date\date.h(4015): message : see declaration of 'date::detail::string_literal<char,5>' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9516420Z D:\a\date\date\include\date\date.h(4231,28): message : while evaluating constexpr function 'date::detail::operator +' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9523840Z D:\a\date\date\include\date\date.h(4450,12): message : while evaluating constexpr function 'date::detail::msl' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9524393Z D:\a\date\date\test\date_test\durations_output.pass.cpp(316,28): message : while evaluating constexpr function 'date::detail::get_units' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9524890Z D:\a\date\date\test\date_test\durations_output.pass.cpp(316,1): error C2248: 'date::detail::string_literal<CharT,6>::string_literal': cannot access private member declared in class 'date::detail::string_literal<CharT,6>' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9525268Z           with
2020-04-14T20:45:59.9525592Z           [
2020-04-14T20:45:59.9525907Z               CharT=char
2020-04-14T20:45:59.9526397Z           ]
2020-04-14T20:45:59.9527282Z D:\a\date\date\include\date\date.h(4018): message : see declaration of 'date::detail::string_literal<CharT,6>::string_literal' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9528582Z           with
2020-04-14T20:45:59.9528934Z           [
2020-04-14T20:45:59.9529255Z               CharT=char
2020-04-14T20:45:59.9544771Z           ]
2020-04-14T20:45:59.9545199Z D:\a\date\date\include\date\date.h(4015): message : see declaration of 'date::detail::string_literal<CharT,6>' [D:\a\date\date\build\date_test_pass_durations_output_bin.vcxproj]
2020-04-14T20:45:59.9545557Z           with
2020-04-14T20:45:59.9545860Z           [
2020-04-14T20:45:59.9546164Z               CharT=char
2020-04-14T20:45:59.9546484Z           ]
rigtorp commented 4 years ago

See https://github.com/HowardHinnant/date/pull/572/commits/1f51c9d96abf5e7758409bfbc5b4cdbd27f8abef

rigtorp commented 4 years ago

Looks like it's broken for both 199711L and 201402L.