From: Nick Lewycky Date: Sat, 12 Jul 2008 07:00:52 +0000 (+0000) Subject: operator[] is not defined for list::iterator. Overload it in ilist::iterator X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=066075030ad46b3494480a5f79f05443f947aca7;p=oota-llvm.git operator[] is not defined for list::iterator. Overload it in ilist::iterator to prevent silly things from happening accidentally. PR2171 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53507 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/ilist.h b/include/llvm/ADT/ilist.h index 8d9bab5caaf..41253e030c5 100644 --- a/include/llvm/ADT/ilist.h +++ b/include/llvm/ADT/ilist.h @@ -93,6 +93,10 @@ public: 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) {}