Community
cancel
Showing results for 
Search instead for 
Did you mean: 
rnickb
Beginner
67 Views

namespace bug with icc

The following compiles fine with gcc and clang but fails with icc 2016 (-std=c++14)

 

#include <tuple>                                                                   
#include <type_traits>                                                             
#include <iostream>                                                                
                                                                                   
namespace htl {                                                                    
template<std::size_t... Ix, class Functor, class T>                                
auto map_impl(std::index_sequence<Ix...>, Functor f, const T& t) {                 
  return std::make_tuple(                                                          
    f(std::get<Ix>(t))...                                                          
  );                                                                               
}                                                                                  
                                                                                   
template<class Functor, class T>                                                   
auto map(Functor f, const T& t) {                                                  
  return map_impl(                                                                 
    std::make_index_sequence<std::tuple_size<T>::value>(),                         
    f,                                                                             
    t                                                                              
  );                                                                               
}                                                                                  
}                                                                                  
                                                                                   
namespace detail {                                                                 
template<int I>                                                                    
auto get_subdimension(std::integral_constant<int, I>) {                            
  return std::integral_constant<int, I+1>();                                       
}                                                                                  
                                                                                   
auto get_subdimension(int x) {                                                     
  return x*x;                                                                      
}                                                                                  
                                                                                   
template<class T>                                                                  
auto get_subdimensions(const T& x) {                                               
  return htl::map([](auto x) { return get_subdimension(x); }, x);                  
}                                                                                  
}                                                                                  
                                                                                   
int main() {                                                                       
  auto t1 = std::make_tuple(3, std::integral_constant<int, 7>());                  
  detail::get_subdimensions(t1);                                                   
  return 0;                                                                        
}

 

0 Kudos
1 Reply
Kittur_G_Intel
Employee
67 Views

Hi Ryan,
This is a bug which I've filed with the developers and will update you accordingly, appreciate much.
_Kittur

Reply