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]

[Bug c++/14006] New: Using "typedef typename std::iterator difference_type" causes a segfault.


$ g++ -o test test.cc
test.cc:24: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Environment:
System: Linux wrynose 2.6.1 #3 Tue Jan 20 23:27:03 GMT 2004 i686 GNU/Linux
Architecture: i686

	
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux

How-To-Repeat:
    1	#include <iterator>
    2	
    3	template<typename T>
    4	class myclass
    5	{
    6	private:
    7	  T m_value;
    8	public:
    9	  myclass(T& value): m_value(value) {}
   10	
   11	  class myiter : public std::iterator<std::random_access_iterator_tag, T, std::size_t>
   12	  {
   13	  public:
   14	    typedef std::size_t size_type;
   15	    typedef typename std::iterator difference_type;
   16	
   17	  private:
   18	    size_type m_pos;
   19	
   20	    myiter(size_type pos): m_pos(pos) {}
   21	
   22	  public:
   23	    myiter operator + (difference_type incr)
   24	    {
   25	      size_type pos = m_pos;
   26	      if (pos + incr < m_result->size())
   27		pos += incr;
   28	      else
   29		pos = m_result->size();
   30	      return myiter(*m_result, pos);
   31	    }
   32	  };
   33	};
   34	
   35	int main()
   36	{
   37	  myclass<int> i;
   38	  return 0;
   39	}
------- Additional Comments From rleigh at debian dot org  2004-02-03 19:51 -------
Fix:
None, sorry.

-- 
           Summary: Using "typedef typename std::iterator difference_type"
                    causes a segfault.
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rleigh at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14006


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