Fix usage of flat_hash_map with move only keys#1894
Fix usage of flat_hash_map with move only keys#1894gnusi wants to merge 1 commit intoabseil:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
f2c5776 to
e2d31c1
Compare
e2d31c1 to
7d143c9
Compare
derekmauro
left a comment
There was a problem hiding this comment.
Could you also add a test case like the one in the example to prevent a regression?
|
|
||
| emplace(new_slot); | ||
| if (is_relocatable) { | ||
| if constexpr (kIsRelocatable) { |
There was a problem hiding this comment.
This is now producing a warning:
./absl/container/internal/container_memory.h:434:35: error: parameter 'alloc' set but not used [-Werror=unused-but-set-parameter]
434 | static auto transfer(Allocator* alloc, slot_type* new_slot,
It seems that whatever analysis GCC is doing doesn't understand constexpr branches.
I'm guessing [[maybe_unused]] will fix this. Or perhaps kIsRelocatable could be a bool and the std::conjunction should use ::value instead of ::type(), maybe that would also give GCC a hint?
There was a problem hiding this comment.
Let me try, I'm going to also add a test case as requested.
This PR fixes compilation of
flat_hash_mapwith move only keys, e.g. the following code won't compile:The reason is that compiler tries to compile a wrong branch due to some values and
if's aren't marked withconstexpr.