brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · f666e8b Raw
50 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <functional>10 11#include <functional>12 13#include "test_macros.h"14 15struct Incomplete;16template<class T> struct Holder { T t; };17typedef Holder<Incomplete> *Ptr;18 19Ptr no_args() { return nullptr; }20Ptr one_arg(Ptr p) { return p; }21Ptr two_args(Ptr p, Ptr) { return p; }22Ptr three_args(Ptr p, Ptr, Ptr) { return p; }23 24void one_arg_void(Ptr) { }25 26int main(int, char**)27{28    Ptr x = nullptr;29    const Ptr cx = nullptr;30    (void)std::ref(no_args)();31    (void)std::ref(one_arg)(x);32    (void)std::ref(one_arg)(cx);33    (void)std::ref(two_args)(x, x);34    (void)std::ref(two_args)(x, cx);35    (void)std::ref(two_args)(cx, x);36    (void)std::ref(two_args)(cx, cx);37    (void)std::ref(three_args)(x, x, x);38    (void)std::ref(three_args)(x, x, cx);39    (void)std::ref(three_args)(x, cx, x);40    (void)std::ref(three_args)(cx, x, x);41    (void)std::ref(three_args)(x, cx, cx);42    (void)std::ref(three_args)(cx, x, cx);43    (void)std::ref(three_args)(cx, cx, x);44    (void)std::ref(three_args)(cx, cx, cx);45    (void)std::ref(one_arg_void)(x);46    (void)std::ref(one_arg_void)(cx);47 48    return 0;49}50