[Bug c++/57899] [4.8/4.9 Regression] bind/function with data member: infinite recursion
rafal at rawicki dot org
gcc-bugzilla@gcc.gnu.org
Tue Jan 21 18:29:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57899
--- Comment #13 from Rafał Rawicki <rafal at rawicki dot org> ---
Right, the reduced testcase is invalid. I'll try to generate a valid one.
In the meantime, I looked at the corresponding place in <functional> (gcc
4.8.2):
1125 /**
1126 * If the argument is a bind expression, we invoke the underlying
1127 * function object with the same cv-qualifiers as we are given and
1128 * pass along all of our arguments (unwrapped). [TR1 3.6.3/5 bullet 2]
1129 */
1130 template<typename _Arg>
1131 class _Mu<_Arg, true, false>
1132 {
1133 public:
1134 template<typename _CVArg, typename... _Args>
1135 auto operator()(_CVArg& __arg, tuple<_Args...>& __tuple) const
volatile
1136 -> decltype(__arg(declval<_Args>()...))
1137 {
1138 // Construct an index tuple and forward to __call
1139 typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
1140 _Indexes;
1141 return __arg(std::forward<_Args>(get<_Indexes>(__tuple))...);
1142 //return this->__call(__arg, __tuple, _Indexes());
1143 }
1144
1145 private:
1146 // Invokes the underlying function object __arg by unpacking all
1147 // of the arguments in the tuple.
1148 template<typename _CVArg, typename... _Args, std::size_t...
_Indexes>
1149 auto __call(_CVArg& __arg, tuple<_Args...>& __tuple, const
_Index_tuple<_Indexes...>&) const volatile
1150 -> decltype(__arg(declval<_Args>()...))
1151 {
1152 return __arg(std::forward<_Args>(get<_Indexes>(__tuple))...);
1153 }
1154 };
When I commented out return statement in the operator() and put _call body in
that place I got ICE without infinite recursion.
More information about the Gcc-bugs
mailing list