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 // Check that libc++'s emulation of std::function is deprecated in C++03
13
14 // REQUIRES: c++03
15
16 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX03_FUNCTION
17
18 #include <functional>
19 #include "test_macros.h"
20
main(int,char **)21 int main(int, char**) {
22 // Note:
23 // We use sizeof() to require it to be a complete type. We don't create a
24 // variable because otherwise we get two warnings for each variable (the
25 // second warning is when the destructor is implicitly called).
26 (void)sizeof(std::function<void ()>); // expected-warning {{'function<void ()>' is deprecated}}
27 (void)sizeof(std::function<void (int)>); // expected-warning {{'function<void (int)>' is deprecated}}
28 (void)sizeof(std::function<void (int, int)>); // expected-warning {{'function<void (int, int)>' is deprecated}}
29 (void)sizeof(std::function<void (int, int, int)>); // expected-warning {{'function<void (int, int, int)>' is deprecated}}
30 return 0;
31 }
32