//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // class function // Test that we properly return both values and void for all non-variadic // overloads of function::operator()(...) #define _LIBCPP_HAS_NO_VARIADICS #include #include int foo0() { return 42; } int foo1(int) { return 42; } int foo2(int, int) { return 42; } int foo3(int, int, int) { return 42; } int main() { { std::function f(&foo0); assert(f() == 42); } { std::function f(&foo1); assert(f(1) == 42); } { std::function f(&foo2); assert(f(1, 1) == 42); } { std::function f(&foo3); assert(f(1, 1, 1) == 42); } { std::function f(&foo0); f(); } { std::function f(&foo1); f(1); } { std::function f(&foo2); f(1, 1); } { std::function f(&foo3); f(1, 1, 1); } }