| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// <functional> |
| 10 |
|
| 11 |
#include <functional> |
| 12 |
|
| 13 |
#include "test_macros.h" |
| 14 |
|
| 15 |
struct Incomplete; |
| 16 |
template<class T> struct Holder { T t; }; |
| 17 |
typedef Holder<Incomplete> *Ptr; |
| 18 |
|
| 19 |
Ptr no_args() { return nullptr; } |
| 20 |
Ptr one_arg(Ptr p) { return p; } |
| 21 |
Ptr two_args(Ptr p, Ptr) { return p; } |
| 22 |
Ptr three_args(Ptr p, Ptr, Ptr) { return p; } |
| 23 |
|
| 24 |
void one_arg_void(Ptr) { } |
| 25 |
|
| 26 |
int main(int, char**) |
| 27 |
{ |
| 28 |
Ptr x = nullptr; |
| 29 |
const Ptr cx = nullptr; |
| 30 |
std::ref(no_args)(); |
| 31 |
std::ref(one_arg)(x); |
| 32 |
std::ref(one_arg)(cx); |
| 33 |
std::ref(two_args)(x, x); |
| 34 |
std::ref(two_args)(x, cx); |
| 35 |
std::ref(two_args)(cx, x); |
| 36 |
std::ref(two_args)(cx, cx); |
| 37 |
std::ref(three_args)(x, x, x); |
| 38 |
std::ref(three_args)(x, x, cx); |
| 39 |
std::ref(three_args)(x, cx, x); |
| 40 |
std::ref(three_args)(cx, x, x); |
| 41 |
std::ref(three_args)(x, cx, cx); |
| 42 |
std::ref(three_args)(cx, x, cx); |
| 43 |
std::ref(three_args)(cx, cx, x); |
| 44 |
std::ref(three_args)(cx, cx, cx); |
| 45 |
std::ref(one_arg_void)(x); |
| 46 |
std::ref(one_arg_void)(cx); |
| 47 |
|
| 48 |
return 0; |
| 49 |
} |