Bug 28783 - Probably a typof() extension problem
Summary: Probably a typof() extension problem
Status: RESOLVED DUPLICATE of bug 13740
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-20 08:59 UTC by Václav Haisman
Modified: 2006-08-20 15:20 UTC (History)
4 users (show)

See Also:
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 (477 bytes, application/octet-stream)
2006-08-20 09:00 UTC, Václav Haisman
Details
Very lightly reduced preprocessed source. (103.23 KB, application/octet-stream)
2006-08-20 09:02 UTC, Václav Haisman
Details

Note You need to log in before you can comment on or make changes to this bug.
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() {
  get_score(_2);
}
Comment 5 Andrew Pinski 2006-08-20 15:20:54 UTC

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