- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
[cpp]
template<class T1 = int, class T2 = int>
class A {};
template<class... TYPES>
void foo(const A<TYPES...>& a) {
}
int main() {
foo(A<double>());
}
[/cpp]
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Raffael,
Thanks for the bug report, we'll track this internally as DPD200253247.
BTW, the problem seems more general than just default arguments, if you try this you'll notice that variadic template argument deduction fails with the call to foo2() also (and shouldn't):
template<class T1 = int, class T2 = int> class A {};
template<class T1, class T2> class A2 {};
template<class... TYPES> void foo(const A<TYPES...>& a);
template<class... TYPES> void foo2(const A2<TYPES...>& a);
int main() {
foo(A<double>());
foo2(A2<int,int>());
return 0;
}
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks a lot :)
Raffael

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page