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

bug with variadic template-template parameters

rnickb
Beginner
320 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
320 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.

0 Kudos
olzhas_r_
New Contributor I
320 Views

This seems to be fixed with icc 17.

0 Kudos
Reply