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

type bug error with icc

$
0
0

The following code compiles with gcc and clang but fails with icc.

#include <tuple>
#include <utility>

template<class, class>
struct right_impl {};

template <std::size_t... Indexes, class... Values>
struct right_impl<std::index_sequence<Indexes...>,
  std::tuple<Values...>>
{
  using type = std::tuple<
      std::tuple_element_t<sizeof...(Values) - sizeof...(Indexes) + Indexes,
                           std::tuple<Values...>>...>;
};

template<int N, class Tuple>
using right_t = typename right_impl<std::make_index_sequence<N>, Tuple>::type;

int main() {
  using T1 = std::tuple<int, float, char>;
  using T2 = right_t<2, T1>;
  static_assert(
    std::is_same<T2, std::tuple<float, char>>::value,"type is incorrect");
  return 0;
}     

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



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