Skip to content

Commit

Permalink
ARROW-11277: [C++] Workaround macOS 10.11: don't default construct co…
Browse files Browse the repository at this point in the history
…nsts

```c++
/tmp/apache-arrow-20210116-6233-1jyrhk8/apache-arrow-3.0.0/cpp/src/arrow/dataset/expression.cc
/tmp/apache-arrow-20210116-6233-1jyrhk8/apache-arrow-3.0.0/cpp/src/arrow/dataset/expression.cc:684:30:
error: default initialization of an object of const type 'const arrow::Datum' without a user-provided default constructor
          static const Datum ignored_input;
```
Datum defines a default constructor but it doesn't seem to be found for const/constexpr decls

Closes #9267 from bkietz/11277-Fix-compilation-error-in-

Authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
  • Loading branch information
bkietz authored and kszucs committed Jan 25, 2021
1 parent 7ee0166 commit 063cbaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cpp/src/arrow/dataset/expression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ Result<Expression> FoldConstants(Expression expr) {
if (std::all_of(call->arguments.begin(), call->arguments.end(),
[](const Expression& argument) { return argument.literal(); })) {
// all arguments are literal; we can evaluate this subexpression *now*
static const Datum ignored_input;
static const Datum ignored_input = Datum{};
ARROW_ASSIGN_OR_RAISE(Datum constant,
ExecuteScalarExpression(expr, ignored_input));

Expand Down
9 changes: 5 additions & 4 deletions cpp/src/arrow/util/future.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct is_future<Future<T>> : std::true_type {};
template <typename Signature>
using result_of_t = typename std::result_of<Signature>::type;

constexpr struct ContinueFuture {
struct ContinueFuture {
template <typename Return>
struct ForReturnImpl;

Expand Down Expand Up @@ -99,7 +99,7 @@ constexpr struct ContinueFuture {

signal_to_complete_next.AddCallback(MarkNextFinished{std::move(next)});
}
} Continue;
};

template <>
struct ContinueFuture::ForReturnImpl<void> {
Expand Down Expand Up @@ -438,13 +438,14 @@ class ARROW_MUST_USE_TYPE Future {

struct Callback {
void operator()(const Result<T>& result) && {
detail::ContinueFuture continue_future;
if (ARROW_PREDICT_TRUE(result.ok())) {
// move on_failure to a(n immediately destroyed) temporary to free its resources
ARROW_UNUSED(OnFailure(std::move(on_failure)));
detail::Continue(std::move(next), std::move(on_success), result.ValueOrDie());
continue_future(std::move(next), std::move(on_success), result.ValueOrDie());
} else {
ARROW_UNUSED(OnSuccess(std::move(on_success)));
detail::Continue(std::move(next), std::move(on_failure), result.status());
continue_future(std::move(next), std::move(on_failure), result.status());
}
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ class ARROW_EXPORT Executor {
Result<FutureType> Submit(TaskHints hints, Function&& func, Args&&... args) {
auto future = FutureType::Make();

auto task = std::bind(::arrow::detail::Continue, future, std::forward<Function>(func),
std::forward<Args>(args)...);
auto task = std::bind(::arrow::detail::ContinueFuture{}, future,
std::forward<Function>(func), std::forward<Args>(args)...);
ARROW_RETURN_NOT_OK(SpawnReal(hints, std::move(task)));

return future;
Expand Down

0 comments on commit 063cbaf

Please sign in to comment.