This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
Section: 126.96.36.199 [util.smartptr.shared.cast] Status: C++20 Submitter: Tim Song Opened: 2017-05-11 Last modified: 2021-02-25
View all other issues in [util.smartptr.shared.cast].
View all issues with C++20 status.
Currently 188.8.131.52 [util.smartptr.shared.cast]/4 says:
Requires: The expression dynamic_cast<T*>((U*)nullptr) shall be well formed and shall have well defined behavior.
A dynamic_cast of a null pointer, if well-formed, always has well-defined behavior: it returns a null pointer. The second part is therefore redundant as currently worded. The C++14 version, on the other hand, requires dynamic_cast<T*>(r.get()) to have well-defined behavior, which actually adds something: it requires the user to not trigger the undefined case in [class.cdtor]/5, for instance.
[2017-07 Toronto Monday issue prioritization]
Priority 0; move to Ready
This wording is relative to N4659.
Edit 184.108.40.206 [util.smartptr.shared.cast] as indicated:
shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept;
-4- Requires: The expression dynamic_cast<T*>((U*)0) shall be well formed and shall have well defined behavior.[…]