From 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 6 Sep 2015 18:46:46 +0000 Subject: Import libc++ 3.7.0 release (r246257). --- .../bind/func.bind/func.bind.bind/nested.pass.cpp | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp (limited to 'test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp') diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp new file mode 100644 index 0000000000000..12720f7b550a0 --- /dev/null +++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// unspecified bind(Fn, Types...); +// template +// unspecified bind(Fn, Types...); + +// http://llvm.org/bugs/show_bug.cgi?id=16343 + +#include +#include +#include + +struct power +{ + template + T + operator()(T a, T b) + { + return std::pow(a, b); + } +}; + +struct plus_one +{ + template + T + operator()(T a) + { + return a + 1; + } +}; + +int +main() +{ + using std::placeholders::_1; + + auto g = std::bind(power(), 2, _1); + assert(g(5) == 32); + assert(std::bind(plus_one(), g)(5) == 33); +} -- cgit v1.2.3