[LLVMbugs] [Bug 2171] New: using iplist<T>::iterator operator[] should cause a compile error

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Mar 24 10:40:46 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2171

           Summary: using iplist<T>::iterator operator[] should cause a
                    compile error
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


On IRC we saw this problem:

  Function::arg_iterator AI = Method->arg_begin();
  AI[0].setName("foo");
  AI[1].setName("foo");

which causes a crash at run-time because AI[1] is invalid. There's no need to
support this kind of iteration, as the STL list::iterator doesn't either. We
should make sure that this is a compile error. Perhaps by defining a private
operator[]?


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list