File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1324,6 +1324,9 @@ class enable_observer_from_this : public virtual details::enable_observer_from_t
13241324 * type of smart pointer, then this function will return nullptr.
13251325 */
13261326 observer_ptr<T> observer_from_this () {
1327+ static_assert (std::is_base_of_v<enable_observer_from_this,std::decay_t <T>>,
1328+ " T must inherit from enable_observer_from_this<T>" );
1329+
13271330 return observer_ptr<T>{this_control_block,
13281331 this_control_block ? static_cast <T*>(this ) : nullptr };
13291332 }
@@ -1335,6 +1338,9 @@ class enable_observer_from_this : public virtual details::enable_observer_from_t
13351338 * type of smart pointer, then this function will return nullptr.
13361339 */
13371340 observer_ptr<const T> observer_from_this () const {
1341+ static_assert (std::is_base_of_v<enable_observer_from_this,std::decay_t <T>>,
1342+ " T must inherit from enable_observer_from_this<T>" );
1343+
13381344 return observer_ptr<const T>{this_control_block,
13391345 this_control_block ? static_cast <const T*>(this ) : nullptr };
13401346 }
You can’t perform that action at this time.
0 commit comments