The attached test case has been reported to fail to compile in #boost@FreeNode channel. I am not even sure if it is valid or not, but since its author didn't seem to report it and it is an ICE across all compilers I have, I report it instead of the author. The problem looks like this: $ g++-4.1 -save-temps -fpreprocessed -c -o bind.o bind.ii bind.cxx:36: internal compiler error: in write_type, at cp/mangle.c:1651 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. It is the same with GCC 3.4.4, just on different line in mangle.c. It fails on both Cygwin and FreeBSD. The attached preprocessed source is from Cygwin. I tried to reduce it a bit but I didn't manage to do so, at least not too much. For completeness, I attach also the original source.
Created attachment 12101 [details] Original test case
Created attachment 12102 [details] Very lightly reduced preprocessed source.
Happens with 3.4, 4.0, 4.1 and mainline, reducing.
Confirmed. Reduced testcase: namespace boost{ namespace lambda { template <class T0, class T1> class tuple; template <int I> struct placeholder {}; template <int I, class Act> class action; template <class Base> class lambda_functor; template <class Act, class Args> class lambda_functor_base; enum { FIRST = 0x01, SECOND = 0x02}; template <int I> class function_action {}; template<class Act, class Args> class lambda_functor_base<action<2, Act>, Args> {}; typedef const lambda_functor<placeholder<SECOND> > placeholder2_type; template <class T> class lambda_functor : public T {}; boost::lambda::placeholder2_type free2 = boost::lambda::placeholder2_type(); boost::lambda::placeholder2_type& _2 = free2; template <class Arg1, class Arg2> lambda_functor< lambda_functor_base< action<2, function_action<2> >, tuple<const Arg1, const Arg2> > > bind(const Arg1& a1, const Arg2& a2) {} } } using namespace boost::lambda; struct MyPair { int second; }; template<typename lambda_type> typeof(bind(&MyPair::second, lambda_type())) get_score(lambda_type lambda){} int main() { get_score(_2); }
*** This bug has been marked as a duplicate of 13740 ***