1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <functional> 11 12 // template<class F> 13 // function(F) -> function<see-below>; 14 15 // UNSUPPORTED: c++03, c++11, c++14 16 17 // The deduction guides for std::function do not handle rvalue-ref qualified 18 // call operators and C-style variadics. It also doesn't deduce from nullptr_t. 19 // Make sure we stick to the specification. 20 21 #include <functional> 22 #include <type_traits> 23 24 struct R { }; 25 struct f0 { R operator()() && { return {}; } }; 26 struct f1 { R operator()(int, ...) { return {}; } }; 27 28 int main(int, char**) { 29 std::function f = f0{}; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}} 30 std::function g = f1{}; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}} 31 std::function h = nullptr; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}} 32 return 0; 33 } 34