[libcxx-commits] [libcxx] [libc++] LWG3223 Broken requirements for shared_ptr converting constructors (PR #93071)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 10 07:16:04 PDT 2024


ldionne wrote:

@alexfh I think this is correct behavior, however it is arguably not great. For example, MSVC behaves the same as libc++ after this patch: https://gcc.godbolt.org/z/xd5PdheeG

It looks like libstdc++ doesn't implement the resolution of this LWG issue yet and that's why they still accept this code.

Basically, what happens here is that the `nullptr_t` constructor overload of `std::shared_ptr` checks for the well-formedness of `deleter(ptr)`, where `ptr` has type `nullptr_t`. This instantiates the lambda and hard-errors inside the body of the lambda, because that's not an immediate context for SFINAE.

@CaseyCarter Was this an intended effect of the wording changes in http://wg21.link/LWG3233 ? CC @jwakely also

https://github.com/llvm/llvm-project/pull/93071


More information about the libcxx-commits mailing list