How to compile/link Boost with clang++/libc++?

I didn’t know how to do this either. But after poking around in here, the getting started, and trial and error: $ ./bootstrap –with-toolset=clang $ ./b2 clean $ ./b2 toolset=clang cxxflags=”-stdlib=libc++” linkflags=”-stdlib=libc++” You’ll get lots of warnings. And the signals library will fail to build due to LWG 2059. But otherwise I think it works.

On mac, g++ (clang) fails to search /usr/local/include and /usr/local/lib by default

I also use Homebrew and had a similar problem on Mac OSX Maverick 10.9.5 and Xcode 6.0.1, but it was solved by running: xcode-select –install Note that it doesn’t work without the double hyphens given by the previous answer. This installs the command-line tools that also create /usr/lib/ and /usr/include/. I don’t know why Homebrew … Read more

Is there a compiler bug exposed by my implementation of an is_complete type trait?

The problem appears to be with the definition of void_t. Defining it as template<typename… Ts> struct make_void { typedef void type;}; template<typename… Ts> using void_t = typename make_void<Ts…>::type; instead yields the correct result (10) on both compilers (Demo). I believe this is the same issue noted in section 2.3 of N3911, the paper proposing void_t, … Read more

Where is Clang’s ‘_mm256_pow_ps’ intrinsic?

That’s not an intrinsic; it’s an Intel SVML library function name that confusingly uses the same naming scheme as actual intrinsics. There’s no vpowps instruction. (AVX512ER on Xeon Phi does have the semi-related vexp2ps instruction…) IDK if this naming scheme is to trick people into depending on Intel tools when writing SIMD code with their … Read more

Constexpr pointer value

As Luc Danton notes, your attempts are blocked by the rules in [expr.const]/2 which say that various expressions are not allowed in core constant expressions, including: — a reinterpret_cast — an operation that would have undefined behavior [Note: including […] certain pointer arithmetic […] — end note] The first bullet rules out your first example. … Read more

How to make clang compile to llvm IR

Given some C/C++ file foo.c: > clang -S -emit-llvm foo.c Produces foo.ll which is an LLVM IR file. The -emit-llvm option can also be passed to the compiler front-end directly, and not the driver by means of -cc1: > clang -cc1 foo.c -emit-llvm Produces foo.ll with the IR. -cc1 adds some cool options like -ast-print. … Read more