Opened 5 years ago
#13450 new Bugs
boost_beast tests are failing on Windows with Intel's compiler due to incorrect boost_asio config.hpp file
| Reported by: | Owned by: | chris_kohlhoff | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | asio |
| Version: | Boost 1.66.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
$ cd boost_1_66_0/libs/beast/test/beast
$ C:/Users/ikelarev/test5/boost_1_66_0/b2 toolset=intel-18_0-vc14.1 address-model=64 --hash --disable-icu --reconfigure -d+1 -d+2 cflags=" " core
...
icl @"..\..\..\..\bin.v2\libs\beast\test\beast\core.test\907320e2b6757701b88c115bc51c431a\core.obj.rsp"
...
../../../../boost/beast/core/detail/bind_handler.hpp(109): error: namespace "boost::asio" has no member "associated_allocator_t"
boost::asio::associated_allocator_t<Handler>;
^
../../../../boost/beast/core/detail/bind_handler.hpp(109): error: expected a ";"
boost::asio::associated_allocator_t<Handler>;
^
../../../../boost/beast/core/impl/buffered_read_stream.ipp(53): error: namespace "boost::asio" has no member "associated_allocator_t"
boost::asio::associated_allocator_t<Handler>;
^
../../../../boost/beast/core/impl/buffered_read_stream.ipp(53): error: expected a ";"
boost::asio::associated_allocator_t<Handler>;
^
../../../../boost/beast/core/impl/buffered_read_stream.ipp(62): error: namespace "boost::asio" has no member "associated_executor_t"
boost::asio::associated_executor_t<Handler, decltype(
^
compilation aborted for core.cpp (code 4)
associated_allocator_t is defined in boost/asio/associated_allocator.hpp header file:
#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) template <typename T, typename Allocator = std::allocator<void> > using associated_allocator_t = typename associated_allocator<T, Allocator>::type; #endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
This means that associated_allocator_t will not be defined if BOOST_ASIO_HAS_ALIAS_TEMPLATES macro is not defined. This macro definition is arranged in boost/asio/detail/config.hpp header file:
// Support alias templates on compilers known to allow it. #if !defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) # if !defined(BOOST_ASIO_DISABLE_ALIAS_TEMPLATES) ... # if defined(BOOST_ASIO_MSVC) # if (_MSC_VER >= 1900) # define BOOST_ASIO_HAS_ALIAS_TEMPLATES 1 # endif // (_MSC_VER >= 1900) # endif // defined(BOOST_ASIO_MSVC) # endif // !defined(BOOST_ASIO_DISABLE_ALIAS_TEMPLATES) #endif // !defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
This means that BOOST_ASIO_MSVC macro is required for BOOST_ASIO_HAS_ALIAS_TEMPLATES definition. BOOST_ASIO_MSVC definition is arranged in the same file before.
// Microsoft Visual C++ detection.
#if !defined(BOOST_ASIO_MSVC)
# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
# define BOOST_ASIO_MSVC BOOST_MSVC
# elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \
|| (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
# define BOOST_ASIO_MSVC _MSC_VER
# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
#endif // defined(BOOST_ASIO_MSVC)
It's obvious from the code that BOOST_ASIO_HAS_BOOST_CONFIG and BOOST_MSVC macros are required for BOOST_ASIO_MSVC macro definition. BOOST_ASIO_HAS_BOOST_CONFIG macro is actually defined but BOOST_MSVC macro is defined only for Microsoft cl compiler. For Intel's icl compiler BOOST_MSVC macro is not defined and BOOST_INTEL macro is defined instead.
As a result BOOST_ASIO_MSVC and BOOST_ASIO_HAS_ALIAS_TEMPLATES macros will not be defined. And finally 'namespace "boost::asio" has no member "associated_allocator_t"' error appears.
One of possible solutions is to add this code into boost/asio/detail/config.hpp file:
#if !defined(BOOST_ASIO_MSVC)
# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
# define BOOST_ASIO_MSVC BOOST_MSVC
+# elif defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_INTEL)
+# define BOOST_ASIO_MSVC BOOST_INTEL
# elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \
|| (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
# define BOOST_ASIO_MSVC _MSC_VER
