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]

Re: egcs-970929: bug in overloading resolution


On 1 Oct 1997, Jason Merrill wrote:

> I'll need a complete testcase if I'm going to work on this bug.
> 
> Jason

Here it is. My command line is 'g++ -Wall -g test.cc'.
Thank you!

Best regards, 
Dirk Herrmann
#include <vector>
#include <iterator>

template<class Container>
class range_iterator
{
  public:
    range_iterator() {}
    explicit range_iterator(Container& c) 
	: pos(c.begin()), end(c.end()) {}
    ~range_iterator() {}

    range_iterator<Container>& operator ++() 
	{ if (*this) ++pos; return *this; }
    operator bool() const 
	{ return pos != end; }
    operator typename Container::iterator() 
        { return pos; }

  protected:
    typename Container::iterator pos;
    typename Container::iterator end;
};


int main()
{
    vector<int> v(10);

    int count = 0;

    for ( range_iterator< vector<int> > i(v); 
	  i; 
	  ++i) 
    {
	cout << count++ << '\n';
    };

    return 0;
}

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