This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/6230: Using not1() from std_function.h causes ICE


Synopsis: Using not1() from std_function.h causes ICE

State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Tue Apr  9 00:58:48 2002
State-Changed-Why:
    Here's the useful bit:
    
    #include <algorithm>
    #include <list>
    #include <functional>
    
    class Foo 
    {
    public:
      int myvar;
    public:
      Foo (int v) { myvar = v; }
      class lt 
      {
      private:
        int bound;
      public:
        lt(const int b) :bound(b) { }
        bool operator() (const Foo & foo) 
        { return foo.myvar < bound; }
      };
    };
    
    int main (void)
    {
      using namespace std;
      list<Foo> l;
      for (int i = 0; i < 100; i++) 
        l.push_back(Foo(i));
      remove_if( l.begin(), l.end(), not1( Foo::lt(50) ) );
      return 0;
    }
    
    
    on gcc-3.1-20020409 it gives:
    
    6230.cc: In instantiation of `std::unary_negate<Foo::lt>':
    6230.cc:28:   instantiated from here
    6230.cc:28: no type named `argument_type' in `class Foo::lt'
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_function.h:278: no
       type named `argument_type' in `class Foo::lt'
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algo.h: In
       function `_OutputIter std::remove_copy_if(_InputIter, _InputIter, 
       _OutputIter, _Predicate) [with _InputIter = std::_List_iterator<Foo, Foo&, 
       Foo*>, _OutputIter = std::_List_iterator<Foo, Foo&, Foo*>, _Predicate = 
       std::unary_negate<Foo::lt>]':
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algo.h:1085:   instantiated from `_ForwardIter std::remove_if(_ForwardIter, _ForwardIter, _Predicate) [with _ForwardIter = std::_List_iterator<Foo, Foo&, Foo*>, _Predicate = std::unary_negate<Foo::lt>]'
    6230.cc:28:   instantiated from here
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algo.h:1016: no
       match for call to `(std::unary_negate<Foo::lt>) (Foo&)'
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algo.h: In
       function `_InputIter std::find_if(_InputIter, _InputIter, _Predicate, 
       std::input_iterator_tag) [with _InputIter = std::_List_iterator<Foo, Foo&, 
       Foo*>, _Predicate = std::unary_negate<Foo::lt>]':
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algo.h:318:   instantiated from `_InputIter std::find_if(_InputIter, _InputIter, _Predicate) [with _InputIter = std::_List_iterator<Foo, Foo&, Foo*>, _Predicate = std::unary_negate<Foo::lt>]'
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algo.h:1083:   instantiated from `_ForwardIter std::remove_if(_ForwardIter, _ForwardIter, _Predicate) [with _ForwardIter = std::_List_iterator<Foo, Foo&, Foo*>, _Predicate = std::unary_negate<Foo::lt>]'
    6230.cc:28:   instantiated from here
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algo.h:188: no
       match for call to `(std::unary_negate<Foo::lt>) (Foo&)'

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6230


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]