Issue 91266
Summary [libc++] Falsely rejected code for `std::unique_ptr` because `__compressed_pair` requires different types.
Labels libc++
Assignees
Reporter SainoNamkho
    As shown in https://godbolt.org/z/4K6q9bo3e, only libc++ 
```c++
#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.

1. Why does `__compressed_pair` require the two template arguments to be the same and the `_CanBeEmptyBase` traits? If they makes 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.
2. 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>, ...>`?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to