The wil::com_ptr_t method try_copy_to is supposed to be a non-exceptional way to copy the held COM interface pointer into a raw output pointer (potentially of a different interface type). However, it's not marked noexcept which can cause problems when using high warning levels on static analyzers (e.g. see C26447 from the C++ Core Guidelines checker). It seems like try_copy_to and the transitively called functions in query_policy should be marked noexcept, as they all return error codes and only interact with other non-exceptional APIs (e.g. QueryInterface).
The
wil::com_ptr_t
methodtry_copy_to
is supposed to be a non-exceptional way to copy the held COM interface pointer into a raw output pointer (potentially of a different interface type). However, it's not markednoexcept
which can cause problems when using high warning levels on static analyzers (e.g. see C26447 from the C++ Core Guidelines checker). It seems liketry_copy_to
and the transitively called functions inquery_policy
should be markednoexcept
, as they all return error codes and only interact with other non-exceptional APIs (e.g.QueryInterface
).