Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLib][Windows] warning: moving a temporary object prevents copy elision [-Wpessimizing-move] #36524

Closed
kou opened this issue Jul 7, 2023 · 0 comments · Fixed by #36531
Closed

Comments

@kou
Copy link
Member

kou commented Jul 7, 2023

Describe the bug, including details regarding any error messages, version, and platform.

https://github.com/apache/arrow/actions/runs/5430048162/jobs/9875509422#step:10:188

In file included from ../../c_glib/arrow-glib/compute.cpp:28:
../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_cast(GArrowArray*, GArrowDataType*, GArrowCastOptions*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = std::shared_ptr<arrow::Array>; CONTEXT_FUNC = garrow_array_cast(GArrowArray*, GArrowDataType*, GArrowCastOptions*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
../../c_glib/arrow-glib/compute.cpp:4707:20:   required from here
../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
   49 |       std::string context = std::move(context_func());
      |                   ^~~~~~~
../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call
../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_unique(GArrowArray*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = std::shared_ptr<arrow::Array>; CONTEXT_FUNC = garrow_array_unique(GArrowArray*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
../../c_glib/arrow-glib/compute.cpp:4740:20:   required from here
../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call
../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_dictionary_encode(GArrowArray*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = arrow::Datum; CONTEXT_FUNC = garrow_array_dictionary_encode(GArrowArray*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
../../c_glib/arrow-glib/compute.cpp:4773:20:   required from here
../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call

Component(s)

GLib

@kou kou added the Type: bug label Jul 7, 2023
kou added a commit to kou/arrow that referenced this issue Jul 7, 2023
    In file included from ../../c_glib/arrow-glib/compute.cpp:28:
    ../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_cast(GArrowArray*, GArrowDataType*, GArrowCastOptions*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
    ../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = std::shared_ptr<arrow::Array>; CONTEXT_FUNC = garrow_array_cast(GArrowArray*, GArrowDataType*, GArrowCastOptions*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
    ../../c_glib/arrow-glib/compute.cpp:4707:20:   required from here
    ../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
       49 |       std::string context = std::move(context_func());
          |                   ^~~~~~~
    ../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call
    ../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_unique(GArrowArray*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
    ../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = std::shared_ptr<arrow::Array>; CONTEXT_FUNC = garrow_array_unique(GArrowArray*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
    ../../c_glib/arrow-glib/compute.cpp:4740:20:   required from here
    ../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
    ../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call
    ../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_dictionary_encode(GArrowArray*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
    ../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = arrow::Datum; CONTEXT_FUNC = garrow_array_dictionary_encode(GArrowArray*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
    ../../c_glib/arrow-glib/compute.cpp:4773:20:   required from here
    ../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
    ../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call
@kou kou closed this as completed in #36531 Jul 7, 2023
kou added a commit that referenced this issue Jul 7, 2023
### Rationale for this change

Message from compiler:

    In file included from ../../c_glib/arrow-glib/compute.cpp:28:
    ../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_cast(GArrowArray*, GArrowDataType*, GArrowCastOptions*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
    ../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = std::shared_ptr<arrow::Array>; CONTEXT_FUNC = garrow_array_cast(GArrowArray*, GArrowDataType*, GArrowCastOptions*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
    ../../c_glib/arrow-glib/compute.cpp:4707:20:   required from here
    ../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
       49 |       std::string context = std::move(context_func());
          |                   ^~~~~~~
    ../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call
    ../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_unique(GArrowArray*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
    ../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = std::shared_ptr<arrow::Array>; CONTEXT_FUNC = garrow_array_unique(GArrowArray*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
    ../../c_glib/arrow-glib/compute.cpp:4740:20:   required from here
    ../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
    ../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call
    ../../c_glib/arrow-glib/error.hpp: In instantiation of 'gboolean garrow::check(GError**, const arrow::Status&, CONTEXT_FUNC&&) [with CONTEXT_FUNC = garrow_array_dictionary_encode(GArrowArray*, GError**)::<lambda()>&; gboolean = int; GError = _GError]':
    ../../c_glib/arrow-glib/error.hpp:71:17:   required from 'gboolean garrow::check(GError**, const arrow::Result<T>&, CONTEXT_FUNC&&) [with TYPE = arrow::Datum; CONTEXT_FUNC = garrow_array_dictionary_encode(GArrowArray*, GError**)::<lambda()>; gboolean = int; GError = _GError]'
    ../../c_glib/arrow-glib/compute.cpp:4773:20:   required from here
    ../../c_glib/arrow-glib/error.hpp:49:19: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
    ../../c_glib/arrow-glib/error.hpp:49:19: note: remove 'std::move' call

### What changes are included in this PR?

Remove a needless `std::move()`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* Closes: #36524

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
@kou kou added this to the 13.0.0 milestone Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant