1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03
14 // template<CopyConstructible Fn, CopyConstructible... Types>
15 // unspecified bind(Fn, Types...);
16 // template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
17 // unspecified bind(Fn, Types...);
19 // http://llvm.org/bugs/show_bug.cgi?id=22003
23 struct DummyUnaryFunction
26 int operator()(S const &) const { return 0; }
29 struct BadUnaryFunction
32 constexpr int operator()(S const &) const
34 // Trigger a compile error if this function is instantiated.
35 // The constexpr is needed so that it is instantiated while checking
36 // __invoke_of<BadUnaryFunction &, ...>.
37 static_assert(!std::is_same<S, S>::value, "Shit");
44 // Check that BadUnaryFunction::operator()(S const &) is not
45 // instantiated when checking if BadUnaryFunction is a nested bind
46 // expression during b(0). See PR22003.
47 auto b = std::bind(DummyUnaryFunction(), BadUnaryFunction());
49 auto b2 = std::bind<long>(DummyUnaryFunction(), BadUnaryFunction());