Variadic tuple_cat (>2 args) not working?

Variadic tuple_cat (>2 args) not working?

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)

 

AttachmentSize
Downloadtext/x-c++src tuple_cat_3_0.cpp137 bytes
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

 

I have been able to reproduce the problem and have submitted into our internal bugs database as DPD200538459.

thanks for reporting it.

Judy

Hi Daniel,

This issue should be resolved in the Intel(R) C++ Compiler 15.0.2 now released (part of the Intel(R) Parallel Studio XE 2015 update 2 packages).

Brandon Hewitt
Technical Consulting Engineer

For 1:1 technical support: http://premier.intel.com

Software Product Support info: http://www.intel.com/software/support

Leave a Comment

Please sign in to add a comment. Not a member? Join today