https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192303
Bug ID: 192303
Summary: C++11 std::list<>::remove_if() visits elements
multiple times
Product: Base System
Version: 10.0-STABLE
Hardware: amd64
OS: Any
Status: Needs Triage
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
Created attachment 145205
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=145205&action=edit
Bug demo
When calling std::list<>::remove_if() with a lambda for the condition (I did
not test without lambdas), it visits the list entry *following* a delete twice.
Attached is a demo of the bug. The number of visits should be 10:
# ./main
Initial list: 0 1 2 3 4 5 6 7 8 9
Remove odd numbers ...
| val | remove
|-----|--------
| 0 |
| 1 | X
| 2 |
| 2 |
| 3 | X
| 4 |
| 4 |
| 5 | X
| 6 |
| 6 |
| 7 | X
| 8 |
| 8 |
| 9 | X
Updated list: 0 2 4 6 8
Visits: 14
Build the test program with:
# make CXX="c++ -std=c++11" main
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"