Use the official Boost.Hana with MSVC 2017 Update 8 compiler

Ulzii

August 30th, 2018

We would like to share a progress update to our previous announcement regarding enabling Boost.Hana with MSVC compiler. Just as a quick background, Louis Dionne, the Boost.Hana author, and us have jointly agreed to provide a version of Boost.Hana in vcpkg to promote usage of the library among more C++ users from the Visual C++ community. We’ve identified a set of blocking bugs and workarounds and called them out in our previous blog, and stated that as we fix the remaining bugs, we will gradually update the version of Boost.Hana in vcpkg, ultimately removing it and replacing it with master repo. We can conduct this development publicly in vcpkg without hindering new users who take a dependency on the library.

Today, we’re happy to announce that the vcpkg version of Boost.Hana now just points to the official master repo, instead of our fork.

With VS2017 Update 8 MSVC compiler, the Boost.Hana official repo with this pull request or later will build clean. We recommend you take the dependency via vcpkg.

For full transparency, below is where we stand with respect to active bugs and used source workarounds as of August 2018:

Source workarounds in place

There are 3 remaining workarounds in Boost.Hana official repo for active bugs in VS2017 Update 8 compiler:

// Multiple copy/move ctors #define BOOST_HANA_WORKAROUND_MSVC_MULTIPLECTOR_106654 // Forward declaration of class template member function returning decltype(auto) #define BOOST_HANA_WORKAROUND_MSVC_DECLTYPEAUTO_RETURNTYPE_662735 // Parser incorrectly parses a comparison operation as a template id // This issue only impacts /permissive- or /std:c++17 #define BOOST_HANA_WORKAROUND_MSVC_RDPARSER_TEMPLATEID_616568

Removed 23 source workarounds that are no longer necessary for VS2017 Update 8 release. Full details for more information.

// Fixed by commit f4e60b2ecc169b0a5ec51d713125801adae24bc2, 20180323 // Note, the workaround requires /Zc:externConstexpr #define BOOST_HANA_WORKAROUND_MSVC_NONTYPE_TEMPLATE_PARAMETER_INTERNAL // Fixed by commit c9999d916f1d73bc852de709607b2ca60e76a4c9, 20180513 #define BOOST_HANA_WORKAROUND_MSVC_CONSTEXPR_NULLPTR #define BOOST_HANA_WORKAROUND_MSVC_CONSTEXPR_ARRAY_399280 // error C2131: expression did not evaluate to a constant // test\_include\auto\for_each.hpp #define BOOST_HANA_WORKAROUND_MSVC_FOR_EACH_DISABLETEST // test\functional\placeholder.cpp #define BOOST_HANA_WORKAROUND_MSVC_CONSTEXPR_ADDRESS_DISABLETEST #define BOOST_HANA_WORKAROUND_MSVC_CONSTEXPR_ARRAY_DISABLETEST // Fixed by commit 5ef87ec5d20b45552784a40fe455c04c257c7b08, 20180516 // Generic lambda preparsing and static capture #define BOOST_HANA_WORKAROUND_MSVC_GENERIC_LAMBDA_NAME_HIDING_616190 // Fixed by commit 9c4869e61b5ad301f1fe265193241d2c74729a1c, 20180518 // ICE when try to give warning on the format string for printf // example\misc\printf.cpp #define BOOST_HANA_WORKAROUND_MSVC_PRINTF_WARNING_506518 // Fixed by commit 095130d02c8805517bbaf93d92415041eecbca00, 20180521 // decltype behavior difference when comparing character array and std::string // test\orderable.cpp #define BOOST_HANA_WORKAROUND_MSVC_DECLTYPE_ARRAY_616099 // Fixed by commit a488f9dccbfb4ceade4104c0d8d00e25d6ac7d88, 20180521 // Member with array type // test\issues\github_365.cpp #define BOOST_HANA_WORKAROUND_MSVC_GITHUB365_DISABLETEST // Fixed by commit 7a572ef6535746f1cee5adaa2a41edafca6cf1bc, 20180522 // Member with the same name as the enclosing class // test\issues\github_113.cpp #define BOOST_HANA_WORKAROUND_MSVC_PARSEQNAME_616018_DISABLETEST // Fixed by commit 3c9a06971bf4c7811db1a21017ec509a56d60e59, 20180524 #define BOOST_HANA_WORKAROUND_MSVC_VARIABLE_TEMPLATE_EXPLICIT_SPECIALIZATION_616151 // error C3520: 'Args': parameter pack must be expanded in this context // example\tutorial\integral-branching.cpp #define BOOST_HANA_WORKAROUND_MSVC_LAMBDA_CAPTURE_PARAMETERPACK_616098_DISABLETEST // Fixed by commit 5b1338ce09f7827e5b9248bcba2f519043044fef, 20180529 // Narrowing warning on constant float // example\core\convert\embedding.cpp #define BOOST_HANA_WORKAROUND_MSVC_NARROWING_CONVERSION_FLOAT_616032 // Fixed by commit be8778ab26957ae7c6a36376a9ae2d049d64a095, 20180611 // Pack expansion of decltype // example\hash.cpp #define BOOST_HANA_WORKAROUND_MSVC_PACKEXPANSION_DECLTYPE_616094 // Fixed by commit 5fd2bf807a0320167c72d9960b32d823a634c04d, 20180613 // Parser error when using '{}' in template arguments #define BOOST_HANA_WORKAROUND_MSVC_PARSE_BRACE_616118 // Fixed by commit ce4f90349574b4acc955cf1eb04d7dc6a03a568e, 20180614 // Generic lambda and sizeof... // test\type\is_valid.cpp #define BOOST_HANA_WORKAROUND_MSVC_GENERIC_LAMBDA_RETURN_TYPE_269943 // Return type of generic lambda is emitted as a type token directly after pre-parsing #define BOOST_HANA_WORKAROUND_MSVC_GENERIC_LAMBDA_RETURN_TYPE_610227 // Fixed by commit 120bb866980c8a1abcdd41653fa084d6c8bcd327, 20180615 // Nested generic lambda // test\index_if.cpp #define BOOST_HANA_WORKAROUND_MSVC_NESTED_GENERIC_LAMBDA_615453 // Fixed by commit 884bd374a459330721cf1d2cc96d231de3bc68f9, 20180615 // Explicit instantiation involving decltype // example\tutorial\introspection.cpp #define BOOST_HANA_WORKAROUND_MSVC_DECLTYPE_EXPLICIT_SPECIALIZATION_508556 // Fixed by commit ff9ef6d9fe43c54f7f4680a2701ad73de18f9afb, 20180620 // constexpr function isn't evaluated correctly in SFINAE context #define BOOST_HANA_WORKAROUND_MSVC_SFINAE_CONSTEXPR_616157 // Fixed by commit 19c35b8c8a9bd7dda4bb44cac1d9d446ed1b20ac, 20180625 // Pack expansion of decltype // test\detail\variadic\at.cpp // test\detail\variadic\drop_into.cpp #define BOOST_HANA_WORKAROUND_MSVC_PACKEXPANSION_DECLTYPE_616024

Bugs remaining in the compiler

There are 3 active bugs with the VS2017 Update 8 release. This is down from 25 active bugs from Update 7 release.

We plan to fix these remaining bugs by the VS2017 Update 9 release later this year.

What’s next…

Throughout the remaining updates of Visual Studio 2017, we will continue to exhaust the remaining MSVC bugs that block upstream version of the Boost.Hana library.

We will continue to provide status updates on our progress. Next update will be when we release VS2017 Update 9.

We will ensure that users who take dependency on this library in vcpkg will not be affected by our work.

Where are we with enabling Range-v3 with MSVC? Similarly, we are tracking all Range-v3 blocking bugs in the compiler and fixing them. Our plan is to fix them all in the remaining VS2017 Update 9 release.



In closing

We’d love for you to download Visual Studio 2017 version 15.8 and try out all the new C++ features and improvements. As always, we welcome your feedback. We can be reached via the comments below or via email (visualcpp@microsoft.com). If you encounter other problems with MSVC in Visual Studio 2017 please let us know through Help > Report A Problem in the product, or via Developer Community. Let us know your suggestions through UserVoice. You can also find us on Twitter (@VisualC) and Facebook (msftvisualcpp).

Thank you,

Xiang Fan, Ulzii Luvsanbat