Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

icpc 14.0.1 c++11 Template argument deduction not working?

Daniel_V_2
Beginner
866 Views

I'm having a problem compiling the attached code (which reimplements something like C++14's integer_sequence).

I've attempted compiling with "icpc --std=c++11 (using g++ 4.8.1's libstdc++)", but the compiler refuses to then find and instantiate the templated function. When I remove the "type indirection" (from TH::Indices<...> to TH::THDetail::integer_sequence<unsigned, ...>) then the code compiles.

Both clang 3.3 and g++ 4.8.1 compile this example just fine.

0 Kudos
1 Reply
Judith_W_Intel
Employee
866 Views

 

Hi Daniel,

I have been able to reproduce this and have entered it as  DPD200252873 in our internal bug tracking database.

This looks like a problem with variadic templates used as template aliases -- here is a workaround (inside the #ifdef OK) which avoids the problem:

template<unsigned ...Is>
static void testFunc
#ifdef OK
(typename TH::THDetail::integer_sequence<unsigned, Is ...>)
#else
(TH::Indices<Is ...>)
#endif
 

Thanks for reporting it and we will get this fixed as soon as possible.

Judy

 

 

0 Kudos
Reply