Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7681 Discussions

bug with variadic template-template parameters

rnickb
Beginner
135 Views

This code works with gcc and clang but doesn't compile with icc 2016 with std=c++14

#include <vector>                                                                
#include <iostream>                                                              
                                                                                 
template<template<class...> class Cont, class... Params>                         
auto f(const Cont<Params...>& v) {                                               
  return Cont<double>{};                                                         
}                                                                                
                                                                                 
int main() {                                                                     
  std::vector<float> v;                                                          
  auto w = f(v);                                                                 
  std::cout << std::is_same<decltype(w), std::vector<double>>::value << "\n";    
  return 0;                                                                      
}                                                

 

0 Kudos
2 Replies
olzhas_r_
New Contributor I
135 Views

I got similar failure to compile the following code (simplified version of the original code):

template <template <typename...> Sequence = std::vector>
class Adapter {
  using container_type = Sequence<int>;
};

The code compiles with GCC and Clang.
ICC states that the number of arguments for Sequence in the typedef is not enough.
ICC doesn't seem to take the default arguments into account.

olzhas_r_
New Contributor I
135 Views

This seems to be fixed with icc 17.

Reply