Boost logo

Boost :

Subject: [boost] clang++ isn't getting the BOOST_NO_CXX11_HDR_FUNCTIONAL flag that it needs
From: Chris Cooper (chris.cooper_at_[hidden])
Date: 2014-04-15 15:48:12


Trying to build & run the regression tests for boost 1.55 on my Mac using the clang++ that comes with Xcode 5.1 ("Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)”), it can’t build config_test.cpp because BOOST_NO_CXX11_HDR_FUNCTIONAL isn’t set, and libs/config/test/boost_no_ccx_hdr_functional.ipp definitely doesn’t build (after renaming it to .cpp of course).

If I set CXXFLAGS to "-std=c++11 -stdlib=libc++” everything is fine, but I also need a build of boost that _doesn’t_ use c++11, and it’s the non-c++-11 version that is failing.

I can get around this by manually setting CXXFLAGS to “-DBOOST_NO_CXX11_HDR_FUNCTIONAL” but it seems like the correct way to do this is to add a test to boost/config/compiler/clang.hpp that tests … something… and then sets BOOST_NO_CXX11_HDR_FUNCTIONAL if appropriate.

  1. Would you agree that’s the right place to set BOOST_NO_CXX11_HDR_FUNCTIONAL (when appropriate)?
  2. Any suggestions on the correct test to determine whether BOOST_NO_CXX11_HDR_FUNCTIONAL is needed? It looks like the _has_feature() macro is the preferred method, but I can’t figure out which feature to check for …

Thanks,
Chris

p.s. The text of the 3 errors (when trying to compile boost_no_cxx_hdr_functional) is exceedingly lengthy, but to summarize:

usr/bin/../lib/c++/v1/__functional_base_03:962:22: error: no matching function for call to '__invoke'
    typedef decltype(__invoke(_VSTD::declval<_Fp>())) type;
usr/bin/../lib/c++/v1/__config:496:32: note: expanded from macro 'decltype'
   #define decltype(x) __typeof__(x)
usr/bin/../lib/c++/v1/__functional_base_03:1019:14: note: in instantiation of template class 'std::__1::__invoke_return<int &, false>' requested here
    typename __invoke_return<type&>::type
./boost_no_cxx_hdr_functional.ipp:22:4: note: in instantiation of template class 'std::__1::reference_wrapper<int>' requested here
    std::ref(i);

usr/bin/../lib/c++/v1/__functional_base_03:962:22: error: no matching function for call to '__invoke'
    typedef decltype(__invoke(_VSTD::declval<_Fp>())) type;
usr/bin/../lib/c++/v1/__config:496:32: note: expanded from macro 'decltype'
   #define decltype(x) __typeof__(x)
usr/bin/../lib/c++/v1/__functional_base_03:1019:14: note: in instantiation of template class 'std::__1::__invoke_return<const int &, false>' requested here
    typename __invoke_return<type&>::type
./boost_no_cxx_hdr_functional.ipp:23:4: note: in instantiation of template class 'std::__1::reference_wrapper<const int>' requested here
   std::cref(i);

./boost_no_cxx_hdr_functional.ipp:36:9: error: no member named 'bind' in namespace 'std'; did you mean 'find'?
   std::bind(f, std::placeholders::_1, 0.0f);


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk