Hi,
I've stumbled across a problem where icpc fails to correctly interpret a template argument list expansion. In particular, the problem occurs when a struct is templated on a variadic template argument list and that list is then expanded into a non-trivial expression like std::shared_ptr<T>... as part of a method signature.
Here is a small example:
#include <memory> #include <tuple> template<typename... T> struct A { A(std::shared_ptr<T>... t) : _t(t...) {} std::tuple<std::shared_ptr<T>...> _t; }; int main() { A<int,double> a(std::make_shared<int>(3),std::make_shared<double>(3.1)); return 0; }
Compiling that code works fine on both GCC 4.8.1 and clang 3.4, but fails with ICC (icpc (ICC) 14.0.1 20131008). All compilation was on Linux. The error is:
$ icpc -std=c++11 parameterpack.cc parameterpack.cc(8): error: parameter pack "T" was referenced but not expanded A(std::shared_ptr<T>... t) ^ parameterpack.cc(8): error: pack expansion does not make use of any argument packs A(std::shared_ptr<T>... t) ^ parameterpack.cc(18): error: no instance of constructor "A<T...>::A [with T=<int, double>]" matches the argument list argument types are: (std::shared_ptr<int>, std::shared_ptr<double>) A<int,double> a(std::make_shared<int>(3),std::make_shared<double>(3.1)); ^ compilation aborted for parameterpack.cc (code 2)
If you take out the shared_ptr and just use the plain parameter pack in both the constructor signature and the tuple, ICC manages to compile the code.