Clang ++ only compiles a C ++ 11 program using boost :: format when the -std = C ++ 11 option is discarded

Pay attention to the following C ++ 11 snippet:

#include <boost/format.hpp> int main(int argc, char** argv) { auto s = boost::format(""); return 0; } 

When I compile it with clang using -std=c++11 , I get the following error:

 $ clang++ -std=c++11 -o main main.cpp In file included from main.cpp:1: In file included from /usr/include/boost/format.hpp:19: In file included from /usr/include/boost/detail/workaround.hpp:41: In file included from /usr/include/boost/config.hpp:40: In file included from /usr/include/boost/config/select_stdlib_config.hpp:18: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/cstddef:51:11: error: no member named 'max_align_t' in the global namespace using ::max_align_t; ~~^ 1 error generated. 

Without -std=c++11 everything compiles fine, but clang displays a warning:

 $ clang++ -o main main.cpp main.cpp:5:3: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] auto s = boost::format(""); ^ 

So it seems like a valid workaround is to reset the C ++ 11 flag, since the current version of clang seems to be in C ++ 11 mode? The downside is that you get a lot of warnings.

Is there a better workaround when fully switching to gcc? Fixed fix source code boost :: format or gcc-libs.


System Information:

  • Platform: Arch Linux x86_64
  • Boost version: 1.55.0-6
  • gcc-libs: 4.9.0-1
  • clang ++: 3.4 (tags / RELEASE_34 / final)
+7
c ++ gcc boost c ++ 11 clang
source share
1 answer

The bug now closes. It should be fixed in Arch with clang 3.4-2.

With this commit , Evangelos Foutras merged the following patch from the upstream: http://reviews.llvm.org/rL201729

+2
source share

All Articles