66<section ><sref ref =" [util.smartptr.shared.const]" /></section >
77<submitter >Louis Dionne</submitter >
88<date >11 Jun 2024</date >
9- <priority >99 </priority >
9+ <priority >3 </priority >
1010
1111<discussion >
1212<p >
@@ -27,6 +27,38 @@ which leads to a hard error inside the lambda since it is called with a
2727</p ><p >
2828See <a href =" https://github.com/llvm/llvm-project/pull/93071#issuecomment-2158494851" >LLVM issue 93071 comment</a > for additional context.
2929</p >
30+
31+ <note >2025-10-22; Reflector poll.</note >
32+ <p >
33+ Set priority to 3 after reflector poll.
34+ </p >
35+ <p >
36+ "I don't agree with the proposed resolution. As a general principle,
37+ <code >shared_ptr< T> (p, d)</code > always calls `d(p)` and never
38+ <code >d(static_cast< T*> (p))</code >.
39+ <br />
40+ If we really want to make this work, which is not unreasonable, even though
41+ the fix on the user side is trivial, we should make the `nullptr_t` constructor
42+ templated on <code >same_as< nullptr_t> </code >
43+ (or <code >convertible_to< nullptr_t> </code >?)."
44+ </p >
45+ <p >
46+ "That would break passing `NULL`, only `nullptr` would work.
47+ It can be made to work by checking that `d(p)` is well-formed in a
48+ function parameter with a default argument,
49+ instead of as a template parameter:"
50+ <pre >struct shared_ptr {
51+ template< class Y, class D>
52+ shared_ptr(Y* p, D d, std::void_t< decltype(d(p))> * = nullptr) {}
53+ template< class D>
54+ shared_ptr(std::nullptr_t p, D d, std::void_t< decltype(d(p))> * = nullptr) {}
55+ };
56+ shared_ptr s(new int, [](auto p) {delete p;});
57+ </pre >
58+ </p >
59+ <p >
60+ "Ugh. We don't have to use it everywhere, only these two specific constructors."
61+ </p >
3062</discussion >
3163
3264<resolution >
0 commit comments