I seem to have uncovered yet another internal compiler error with the current 15.0.0 Intel C++ compiler (using C++11):
#include <cstdio> template<class Functor, typename IndexT, void (Functor::*MemberFunction)(const IndexT) const> void LoopMemberFunction(const IndexT start, const IndexT end, const Functor &f) { for (IndexT i = start; i < end; ++i) (f.*MemberFunction)(i); } template<class Functor> void Loop(const int start, const int end, const Functor &f) { LoopMemberFunction<Functor, int, &Functor::operator()>(start, end, f); } int main(int argc, char const *argv[]) { Loop(0, argc, [](const int i) { printf("%i\n", i); }); return 0; }
Compiling the above code using
$ icpc -std=c++11 test.cpp
test.cpp(23): internal error: assertion failed at: "shared/cfe/edgcpfe/lower_name.c", line 8667
compilation aborted for test.cpp (code 4)
It seems to be the combination of lambdas (anonymous functors) and member function pointers that seem to trigger this bug.
Is there any known workaround?