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

Variadic tuple_cat (>2 args) not working?

$
0
0

It seems that a very simple tuple_cat with 3 arguments is not supported by the Intel C++ compiler (15.0.0 Beta Update 2) with supposedly "full C++11 support". The offending code looks like this

auto cc = std::tuple_cat(std::make_tuple(1u), std::make_tuple(2u), std::make_tuple(3u))

and results in the following errors (but works with g++ 4.8.1 and clang). This is very unfortunate as this pattern of concating multiple tuples is very helpful for variadic templates (where some tuples might be empty depending on type-logic). Although the error comes from g++'s headers, the problem seems to be with icc handling of them, as g++ works fine.

> g++ --std=c++11 main.cpp> icc -v
icc version 15.0.0 Beta (gcc version 4.8.1 compatibility)> icc --std=c++11 main.cpp
/home_as/shared/arbeitsgruppen/digitalx/installs/gcc/4.8.1/install/include/c++/4.8.1/tuple(1009): error: pack "__tps" does not have the same number of elements as "_Tpls"
  	  return __next::_S_do(std::forward<_Tpls>(__tps)...,
  	                                           ^
          detected during:
            instantiation of "_Ret std::__tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>::_S_do(_Tp &&, _Tpls &&..., _Us &&...) [with _Ret=std::tuple<int, int, int>, _Is=<0UL>, _Tp=std::tuple<int>, _Tpls=<std::tuple<int>>, _Us=<int>]" at line 1011
            instantiation of "_Ret std::__tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>::_S_do(_Tp &&, _Tpls &&..., _Us &&...) [with _Ret=std::tuple<int, int, int>, _Is=<0UL>, _Tp=std::tuple<int>, _Tpls=<std::tuple<int>, std::tuple<int>>, _Us=<>]" at line 1036
            instantiation of "auto std::tuple_cat(_Tpls &&...)->std::__tuple_cat_result<_Tpls...>::__type [with _Tpls=<std::tuple<int>, std::tuple<int>, std::tuple<int>>, <unnamed>=void]" at line 5 of "main.cpp"

/home_as/shared/arbeitsgruppen/digitalx/installs/gcc/4.8.1/install/include/c++/4.8.1/tuple(1009): error: no instance of function template "std::__tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>::_S_do [with _Ret=std::tuple<int, int, int>, _Is=<0UL>, _Tp=std::tuple<int>, _Tpls=<>]" matches the argument list
            argument types are: (int, int)
  	  return __next::_S_do(std::forward<_Tpls>(__tps)...,
  	         ^
          detected during:
            instantiation of "_Ret std::__tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>::_S_do(_Tp &&, _Tpls &&..., _Us &&...) [with _Ret=std::tuple<int, int, int>, _Is=<0UL>, _Tp=std::tuple<int>, _Tpls=<std::tuple<int>>, _Us=<int>]" at line 1011
            instantiation of "_Ret std::__tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>::_S_do(_Tp &&, _Tpls &&..., _Us &&...) [with _Ret=std::tuple<int, int, int>, _Is=<0UL>, _Tp=std::tuple<int>, _Tpls=<std::tuple<int>, std::tuple<int>>, _Us=<>]" at line 1036
            instantiation of "auto std::tuple_cat(_Tpls &&...)->std::__tuple_cat_result<_Tpls...>::__type [with _Tpls=<std::tuple<int>, std::tuple<int>, std::tuple<int>>, <unnamed>=void]" at line 5 of "main.cpp"

compilation aborted for main.cpp (code 2)

 

AdjuntoTamaño
Descargartuple_cat_3_0.cpp137 bytes

Viewing all articles
Browse latest Browse all 1616

Trending Articles



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