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-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // <functional> |
10 | |
11 | // template<class F> |
12 | // function(F) -> function<see-below>; |
13 | |
14 | // UNSUPPORTED: c++03, c++11, c++14 |
15 | |
16 | // The deduction guides for std::function do not handle rvalue-ref qualified |
17 | // call operators and C-style variadics. It also doesn't deduce from nullptr_t. |
18 | // Make sure we stick to the specification. |
19 | |
20 | #include <functional> |
21 | |
22 | struct R { }; |
23 | struct f0 { R operator()() && { return {}; } }; |
24 | struct f1 { R operator()(int, ...) { return {}; } }; |
25 | |
26 | void f() { |
27 | std::function f = f0{}; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}} |
28 | std::function g = f1{}; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}} |
29 | std::function h = nullptr; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}} |
30 | } |
31 | |