Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

variadic tempalte deduction fails when default arguments are involved

$
0
0

Hi,

While porting some c++ code from linux to windows (using Intel Composer XE 2014 Update 1 on Windows) I came across a piece of code which is similar to the following:

template<class T1 = int, class T2 = int>
class A {};
template<class... TYPES>
void foo(const A<TYPES...>& a) {
}
int main() {
  foo(A<double>());
}

This compiles fine with gcc 4.8.2 and clang 3.4 (using std=c++11) on linux. But intel throws a compilation error, i.e. it seems that it cannot deduce the type of the variadic template parameters TYPES.

Unfortunately the trick with the default template arguments was heavily used by boost to emulate variadic templates prior to c++11. Therefore the above bug implies that many libraries of boost cannot made to work with variadic templates in a simple fashion (although this is no problem with gcc and clang 3.4).

I hope this can be fixed in a future update of the intel compiler,

Raffael


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>