I have the following very simple program that seems to fail on the Intel compiler but not gcc when using boost::lexical_cast (boost version 1.67.0):
#include <boost/lexical_cast.hpp>
#include <string>
#include <iostream>
float getSomeNumber()
{
return 10.0;
}
int main(int argc, char** argv)
{
std::string mystring("Hello: " + boost::lexical_cast<std::string>(getSomeNumber());
std::cout << mystring << std::endl;
return 0;
}
When compiling, Intel returns the following error:
/boost/1.67.0/include/boost/type_traits/is_complete.hpp(45): warning #70: incomplete type is not allowed
ok_tag<sizeof(T)> check_is_complete(int);
detected during ....
...
/boost/1.67.0/include/boost/type_traits/is_complete.hpp(51): error: template instantiation resulted in unexpected function type of "boost::detail::ok_tag<1U> (int)" (the meaning of a name may have changed since the template declaration -- the type of the template is "boost::detail::ok_tag<sizeof(T)> (int)")
...
detected during:
instantiation of "boost::detail::check_is_complete" based on template argument <void> at line 51
instantiation of class "boost::is_complete<T> [with T=void]" at line 484 of "/Path/to/boost/include/boost/type_traits/is_convertible.hpp"
...
instantiation of "Target boost::lexical_cast<Target, Source>(const Source &) [with Target=std::string, Source=float]" at line 11 of "boostTest.cc"
The best I can tell from this error is it seems like the compiler can't complete the template resolution, but then the very end it seems like it does? I tried compiling the same thing under gcc (version 4.8.5) and it worked fine. This code also previously worked fine under boost 1.64.0 with both gcc and Intel.
Is this a bug in the Intel Compiler, or perhaps a bug in boost? Is there a way to modify my program as a workaround?
Software versions
gcc: 4.8.5
Intel Compiler: 2015.3.187
Boost: 1.67.0
OS: RHEL 7.5 (Maipo)
Compile line:
icpc/gcc --std=c++11 boostTest.cc -o boostTest -Ipath/to/boost/include -lstdc++