boostorg / heap

Boost.Heap
https://boost.org/libs/heap
18 stars 39 forks source link

Warning about implicit copy assignment operator in `handle_type` #26

Open burnpanck opened 4 years ago

burnpanck commented 4 years ago

Starting with GCC 9 (though not with GCC 8, nor Clang 9), I get a warning when I assign a mutation handle (-Wdeprecated-copy). The reason seems to be that, because struct handle_type declares a copy constructor (boost/heap/detail/mutable_heap.hpp:94) but not an assignment operator, GCC warns that the implicitly declared one might not be intentionally there.

I assume that in this case, the warning is unnecessary, as the explicit copy constructor really is in fact not any different from an implicit one. Probably, it just needs an accompanying copy assignment operator, possibly as handle_type operator=(handle_type const &) = default; if that is supported by all target compilers.