Bug 28783

Summary: Probably a typof() extension problem
Product: gcc Reporter: Václav Haisman <vhaisman>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: dkouroun, gcc-bugs, jens.maurer, vhaisman
Priority: P3    
Version: 4.1.1   
Target Milestone: ---   
Host: *-*-* Target: *-*-*
Build: *-*-* Known to work:
Known to fail: 3.4.6 4.0.3 4.1.2 4.2.0 Last reconfirmed: 2006-08-20 14:25:42
Attachments: Original test case
Very lightly reduced preprocessed source.

Description Václav Haisman 2006-08-20 08:59:56 UTC
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.
Comment 1 Václav Haisman 2006-08-20 09:00:45 UTC
Created attachment 12101 [details]
Original test case
Comment 2 Václav Haisman 2006-08-20 09:02:10 UTC
Created attachment 12102 [details]
Very lightly reduced preprocessed source.
Comment 3 Richard Biener 2006-08-20 09:08:43 UTC
Happens with 3.4, 4.0, 4.1 and mainline, reducing.
Comment 4 Richard Biener 2006-08-20 14:25:42 UTC
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() {
Comment 5 Andrew Pinski 2006-08-20 15:20:54 UTC

*** This bug has been marked as a duplicate of 13740 ***