[Bug c++/53305] New: internal crash with variadic templates and decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53305 Bug #: 53305 Summary: internal crash with variadic templates and decltype Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ches...@hotmail.com Created attachment 27362 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27362 simplified c++ code that crushes gcc g++ -std=c++0x gcc_bug.cpp -o t gcc_bug.cpp: In member function ‘int funct::operator()(argTs ...)’: gcc_bug.cpp:7:2: error: expected ‘;’ before ‘}’ token gcc_bug.cpp:23: confused by earlier errors, bailing out in the real (and more complex) code, instead the last error message was : internal compiler error: Segmentation fault
[Bug c++/53307] New: internal crash with variadic templates and decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53307 Bug #: 53307 Summary: internal crash with variadic templates and decltype Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ches...@hotmail.com Created attachment 27363 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27363 gcc_bug.cpp Simplified code in the attachment gives below error : gcc_bug.cpp:18:6: internal compiler error: Segmentation fault
[Bug c++/53307] internal crash with variadic templates and decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53307 chesstr at hotmail dot com changed: What|Removed |Added Severity|major |normal
[Bug c++/53307] internal crash with variadic templates and decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53307 chesstr at hotmail dot com changed: What|Removed |Added Attachment #27363|0 |1 is obsolete|| --- Comment #1 from chesstr at hotmail dot com 2012-05-10 17:16:47 UTC --- Created attachment 27366 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27366 better test case It turns out, if the length of parameter pack arg3s... is 0 this bug occurs, if it is not 0 then gcc compiles without any problem.
[Bug c++/53307] internal crash with variadic templates and decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53307 --- Comment #2 from chesstr at hotmail dot com 2012-05-10 20:09:44 UTC --- Comment on attachment 27366 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27366 better test case >#include >template struct tuple{}; > >struct funct{ > template > T operator()(T arg1,argTs...args){ > return arg1; > } >}; > >templateclass test; > >template< template class tp, > class...arg1Ts, > class...arg2Ts> >class test,tp>{ >public: >template >auto test_pass(func fun,arg2Ts...arg2s) -> decltype(fun(arg2s...)) >{ > int gcc_compiles_this; > int internal_gcc_crash=sizeof...(arg2s); > return fun(arg2s...); >} >template >auto testbug(func fun,arg2Ts...arg2s,arg3Ts...arg3s) -> >decltype(fun(arg2s...,arg3s...)) >{ > int clang_compiles_but_not_gcc; > int internal_gcc_crash=sizeof...(arg2s); > return fun(arg2s...,arg3s...); >} >}; > >int main(){ > test,tuple> t; > std::cout< std::cout< //std::cout< <<<<<<<<<<<<<<<<< > std::cout<<"gcc crash : "< <<<<<<<<<<<<<<<<<<<-- >}
[Bug c++/53307] internal crash with variadic templates and decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53307 --- Comment #3 from chesstr at hotmail dot com 2012-05-10 20:57:25 UTC --- Therefore, it seems that 0 length argument packs are not handled correctly in decltype.
[Bug c++/53311] New: [C++0x] argument packs are not handled correctly in decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53311 Bug #: 53311 Summary: [C++0x] argument packs are not handled correctly in decltype Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ches...@hotmail.com Created attachment 27368 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27368 test case with both errors Hi, it seems there are two major argument pack expansion problems in decltype : 1. mismatched argument pack lengths while expanding std::forward(args)... from sample code : = > template > auto testbug1(func fun,arg2Ts...arg2s,arg3Ts...arg3s) -> > decltype(fun(std::forward(arg2s)...,std::forward(arg3s)...)) > { > return > fun(std::forward(arg2s)...,std::forward(arg3s)...); > } = 2. 0 length argument packs in decltype result in ICE ( Bug 53307 : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53307 )
[Bug c++/53311] [C++0x] argument packs are not handled correctly in decltype
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53311 chesstr at hotmail dot com changed: What|Removed |Added Attachment #27368|0 |1 is obsolete|| --- Comment #1 from chesstr at hotmail dot com 2012-05-11 12:36:12 UTC --- Created attachment 27371 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27371 simpler test case Tested and simplified.Uncomment the problematic lines to see the bugs.
[Bug c++/53648] New: nested empty tuple
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53648 Bug #: 53648 Summary: nested empty tuple Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ches...@hotmail.com #include int main(){ auto b = std::tuple>>{}; } gives : error: 'std::_Tuple_impl<1ul>' is an ambiguous base of 'std::_Tuple_impl<0ul, std::tuple > >'
[Bug libstdc++/53648] [C++11] nested empty tuples
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53648 --- Comment #2 from chesstr at hotmail dot com 2012-06-12 17:13:33 UTC --- (In reply to comment #1) > I have a fix for this already, IIRC it's simply a case of not using the EBO > for > a tuple that contains std::tuple<> Yes, an easy fix in tuple implementation by modifying __empty_not_final as below compiles : template using __empty_not_final = typename conditional<__is_final(_Tp)||is_same<_Tp,tuple<>>::value, false_type, is_empty<_Tp>>::type; instead of template using __empty_not_final = typename conditional<__is_final(_Tp), false_type, is_empty<_Tp>>::type;
[Bug libstdc++/53648] [C++11] nested empty tuples
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53648 --- Comment #4 from chesstr at hotmail dot com 2012-06-12 18:03:56 UTC --- (In reply to comment #3) > There are other cases involving non-empty tuples that will still result in an > ambiguity e.g. > > struct A { }; > auto d = tuple, A>, A>{}; > > My solution avoids using the EBO for some condition I don't remember (the > code's on another machine) but it handles all the cases I tested. > > I also preserve the property that sizeof(tuple>)==1, which I > think your suggestion loses. You are right, the suggestion does not solve the real problem at all. Nice example.