Skip to content

Commit

Permalink
SingleLinkedListIterator::operator++(int) shouldn't return a reference
Browse files Browse the repository at this point in the history
The returned reference is to a local object.  Instead, make a copy.

Found by PVS-Studio.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285603 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
majnemer committed Oct 31, 2016
1 parent 09c7eaa commit c6acb51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/LiveInterval.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ namespace llvm {
P = P->Next;
return *this;
}
SingleLinkedListIterator<T> &operator++(int) {
SingleLinkedListIterator<T> operator++(int) {
SingleLinkedListIterator res = *this;
++*this;
return res;
Expand Down

0 comments on commit c6acb51

Please sign in to comment.