Building LLVM 3.8 and later with 2016 Intel C++ compiler

Trying to build LLVM 3.8 (or trunk) with the 2016 Intel C++ compiler. It fails on the std::declval feature:

llvm-3.8/include/llvm/ADT/iterator_range.h(63): error: namespace "std" has no member "declval"
   iterator_range<decltype(begin(std::declval<T>()))> drop_begin(T &&t, int n) {

An isolated std::declval example shows that this compiler doesn't support it. I can't really roll back to an earlier LLVM version since I need the latest LLVM backends (avx512f etc). I also can't really use GCC to build LLVM since I need to build other parts of the project with Intel and linking would then be a problem.

Does this std::declval piece of code happen to be in a place which can be turned on/off with a configure/cmake option?


std::declval doesn't require compiler support, it's provided by the
standard library, and it's trivial to implement. Are you sure that code is
including <utility>?

I am making some progress. The compiler had to be told where a set of updated header files can be found.

Now, I am getting a linker error when it comes to linking the tblgen. This has to do with the updated headers I am sure and I try to find out what's going on. I used 'cmake' and 'make VERBOSE=1' which displays the linker command being used. I'd like to launch this by hand to see it fail. However the intermediate object files have been deleted before the 'make' command returns.

It's linking all the files in CMakeFiles/obj.llvm-tblgen.dir

Anyone knows how to convince 'make' to not delete the object files in case the build fails? (That would help chasing this down)