[llvm-commits] [llvm] r53507 - /llvm/trunk/include/llvm/ADT/ilist.h
    Nick Lewycky 
    nicholas at mxc.ca
       
    Sat Jul 12 00:00:53 PDT 2008
    
    
  
Author: nicholas
Date: Sat Jul 12 02:00:52 2008
New Revision: 53507
URL: http://llvm.org/viewvc/llvm-project?rev=53507&view=rev
Log:
operator[] is not defined for list::iterator. Overload it in ilist::iterator
to prevent silly things from happening accidentally. PR2171
Modified:
    llvm/trunk/include/llvm/ADT/ilist.h
Modified: llvm/trunk/include/llvm/ADT/ilist.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=53507&r1=53506&r2=53507&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ilist.h (original)
+++ llvm/trunk/include/llvm/ADT/ilist.h Sat Jul 12 02:00:52 2008
@@ -93,6 +93,10 @@
   typedef typename super::reference reference;
 private:
   pointer NodePtr;
+
+  // operator[] is not defined. Compile error instead of having a runtime bug.
+  void operator[](unsigned) {}
+  void operator[](unsigned) const {}
 public:
 
   ilist_iterator(pointer NP) : NodePtr(NP) {}
    
    
More information about the llvm-commits
mailing list