Skip to content

Unexpected result is not actually returned

It's generated like that:

gi::result<bool> base::FileManager1Base::call_show_items_finish (Gio::AsyncResult res) noexcept
{
  typedef gboolean (*call_wrap_t) (::XdgFileManager1FileManager1* proxy, ::GAsyncResult* res, GError ** error);
  call_wrap_t call_wrap_v = (call_wrap_t) ::xdg_file_manager1_file_manager1_call_show_items_finish;
  auto res_to_c = gi::unwrap (res, gi::transfer_none);
  GError *error = NULL;
  auto _temp_ret = call_wrap_v ((::XdgFileManager1FileManager1*) (gobj_()), (::GAsyncResult*) (res_to_c), &error);
  if (error) gi::detail::make_unexpected (error);
  return _temp_ret;
}

I guess it actually should be if (error) return gi::detail::make_unexpected (error);. Currently checking the gi::result with operator bool always returns true.

There seem to be two places where make_unexpected is used without return:

  1. https://gitlab.com/mnauw/cppgir/-/blob/master/tools/function.cpp?ref_type=heads#L1647
  2. https://gitlab.com/mnauw/cppgir/-/blob/master/tools/function.cpp?ref_type=heads#L1505
Edited by Ilya Fedin