Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Boost 1.71 - static_assert failure during compilation

Re__Giorgio
Beginner
1,314 Views

Hello,

I would like to report an error during the compilation of a code that uses the beast component of Boost (v1.71.0).

Basically, I obtain the following error when I call the function boost::beast::http::read :

H:/3rdParty_lib/Boost/boost_1_71_0/boost/beast/http/message.hpp(265): error: static assertion failed with "Fields type requirements not met"
      static_assert(is_fields<Fields>::value,
      ^
          detected during:
            instantiation of class "boost::beast::http::header<0, Fields> [with Fields=boost::beast::http::fields]" at line 495
            instantiation of class "boost::beast::http::message<isRequest, Body, Fields> [with isRequest=0, Body=boost::beast::http::string_body, Fields=boost::beast::http::fields]" at line 22 of "H:/TestIntelBoost/main.cpp"
H:/3rdParty_lib/Boost/boost_1_71_0/boost/beast/http/message.hpp(61): error: static assertion failed with "Fields type requirements not met"
      static_assert(is_fields<Fields>::value,
      ^
          detected during:
            instantiation of class "boost::beast::http::header<1, Fields> [with Fields=boost::beast::http::detail::fields_model]" at line 487 of "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits"
            instantiation of class "std::is_constructible<_Ty, _Args...> [with _Ty=boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char>>::reader, _Args=<boost::beast::http::header<1, boost::beast::http::detail::fields_model> &, std::basic_string<char, std::char_traits<char>, std::allocator<char>> &>]" at line 188 of "H:/3rdParty_lib/Boost/boost_1_71_0/boost/beast/http/type_traits.hpp"
            instantiation of class "boost::beast::http::is_body_reader<T, boost::beast::detail::void_t<decltype((<expression>))>> [with T=boost::beast::http::string_body]" at line 489 of "H:/3rdParty_lib/Boost/boost_1_71_0/boost/beast/http/impl/read.hpp"
            instantiation of "size_t={unsigned __int64} boost::beast::http::read(SyncReadStream &, DynamicBuffer &, boost::beast::http::message<isRequest, Body, boost::beast::http::basic_fields<Allocator>> &) [with SyncReadStream=boost::beast::tcp_stream, DynamicBuffer=boost::beast::flat_buffer, isRequest=0, Body=boost::beast::http::string_body, Allocator=std::allocator<char>]" at line 22 of "H:/TestIntelBoost/main.cpp"
H:/3rdParty_lib/Boost/boost_1_71_0/boost/beast/http/message.hpp(265): error: static assertion failed with "Fields type requirements not met"
      static_assert(is_fields<Fields>::value,
      ^
          detected during:
            instantiation of class "boost::beast::http::header<0, Fields> [with Fields=boost::beast::http::detail::fields_model]" at line 487 of "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits"
            instantiation of class "std::is_constructible<_Ty, _Args...> [with _Ty=boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char>>::reader, _Args=<boost::beast::http::header<0, boost::beast::http::detail::fields_model> &, std::basic_string<char, std::char_traits<char>, std::allocator<char>> &>]" at line 191 of "H:/3rdParty_lib/Boost/boost_1_71_0/boost/beast/http/type_traits.hpp"
            instantiation of class "boost::beast::http::is_body_reader<T, boost::beast::detail::void_t<decltype((<expression>))>> [with T=boost::beast::http::string_body]" at line 489 of "H:/3rdParty_lib/Boost/boost_1_71_0/boost/beast/http/impl/read.hpp"
            instantiation of "size_t={unsigned __int64} boost::beast::http::read(SyncReadStream &, DynamicBuffer &, boost::beast::http::message<isRequest, Body, boost::beast::http::basic_fields<Allocator>> &) [with SyncReadStream=boost::beast::tcp_stream, DynamicBuffer=boost::beast::flat_buffer, isRequest=0, Body=boost::beast::http::string_body, Allocator=std::allocator<char>]" at line 22 of "H:/TestIntelBoost/main.cpp"

Please, find in attach a minimal example reproducing the issue which does not happen with Microsoft compiler and note that the same issue is described at the following link without a solution:

https://github.com/boostorg/beast/issues/1259

Here is the version of icl I am using:

$ icl
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.4.245 Build 20190417
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

icl: command line error: no files specified; for help type "icl /help"

Can you please check?

Thanks and best regards.

0 Kudos
5 Replies
Viet_H_Intel
Moderator
1,314 Views

Can you create a preprocessed file from main.cpp and provide it to us? icl /E main.cpp

0 Kudos
Re__Giorgio
Beginner
1,314 Views

Hi,

please find it in attach.

0 Kudos
Viet_H_Intel
Moderator
1,314 Views

Issue has been fixed in ICL19.1 

C:\Temp\vah\main_prep>icl main_prep.cpp /c /W0
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

C:\Temp\vah\main_prep>dir main_prep.obj

01/13/2020  08:37 AM           106,911 main_prep.obj
               1 File(s)        106,911 bytes
               0 Dir(s)   8,831,021,056 bytes free

C:\Temp\vah\main_prep>

0 Kudos
Re__Giorgio
Beginner
1,314 Views

Hi,

can you suggest me a workaround in order to compile the code with v19.0?

Many thanks.

0 Kudos
Viet_H_Intel
Moderator
1,314 Views

Sorry, I'm not aware that we have a workaround in v19.0

0 Kudos
Reply