boostorg / container

STL-like containers from Boost
http://www.boost.org/libs/container/
Boost Software License 1.0
96 stars 116 forks source link

flat_tree::erase_unique uses wrong iterator #236

Closed revorm closed 1 year ago

revorm commented 1 year ago

In flat_tree.hpp on line 1132, erase_unique needs to get a const_iterator from its call to find, otherwise you can run in to trouble resolving the call to erase.

igaztanaga commented 1 year ago

What is the problem when resolving the call? An iterator is convertible to a const_iterator.

revorm commented 1 year ago

For some reason, GCC 11 is unable to resolve if it should call the const_iterator or key_type overload of flat_tree::erase.

It seems like something in my work codebase is triggering this in GCC since it doesn't break with a simple reproducer. It seems, however, that in the specific case of erase_unique we always expect to call the const_iterator overload of erase.

Unfortunately I am not able to produce a simplified reproducer so if you feel like that's insufficient evidence of an issue on your end then feel free to close the issue.

igaztanaga commented 1 year ago

Thanks for the report.

revorm commented 1 year ago

Thanks for the fix!