As shown in https://godbolt.org/z/4K6q9bo3e, only libc++ refuses to compile the following code
#include <memory>
#include <any>
void f(std::any) {}
std::unique_ptr<decltype(f), decltype(f)*> p(f, f);
I've not found anywhere in the draft saying this should be rejected.
- Why does
__compressed_pair require the two template arguments to be distinct and the _CanBeEmptyBase traits? If they make it unable to compress, then an uncompressed layout is automatically produced, with no need to be explicitly rejected. And the indices used by __compressed_pair_elem suggest that it handles same types correctly.
- If it is reasonable to keep the implementation of
__compressed_pair, is it a good solution to change unique_ptr into use something like conditional_t<same_as<pointer, deleter_type>, __compressed_pair<<pointer, deleter_type>, ...>?