summaryrefslogtreecommitdiff
path: root/chromium/base/bind_post_task_unittest.nc
blob: 7bcdbc9f380c596a47a3a256d3939b6ab85e2762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This is a "No Compile Test" suite.
// http://dev.chromium.org/developers/testing/no-compile-tests

#include "base/bind_post_task.h"

#include "base/bind.h"
#include "base/callback.h"
#include "base/threading/sequenced_task_runner_handle.h"

namespace base {

int ReturnInt() {
  return 5;
}

#if defined(NCTEST_ONCE_NON_VOID_RETURN)  // [r"||fatal error: static_assert failed due to requirement 'std::is_same<int, void>::value' \"OnceCallback must have void return type in order to produce a closure for PostTask\(\). Use base::IgnoreResult\(\) to drop the return value if desired.\""]
// OnceCallback with non-void return type.
void WontCompile() {
  OnceCallback<int()> cb = BindOnce(&ReturnInt);
  auto post_cb = BindPostTask(SequencedTaskRunnerHandle::Get(), std::move(cb));
  std::move(post_cb).Run();
}

#endif

}  // namespace base