| 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<Returnable S, ClassType T> |
| 12 |
// mem_fun_ref_t<S,T> |
| 13 |
// mem_fun_ref(S (T::*f)()); |
| 14 |
// Removed in c++17 |
| 15 |
|
| 16 |
// UNSUPPORTED: c++03, c++11, c++14 |
| 17 |
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS |
| 18 |
|
| 19 |
#include <functional> |
| 20 |
#include <cassert> |
| 21 |
|
| 22 |
#include "test_macros.h" |
| 23 |
|
| 24 |
struct A |
| 25 |
{ |
| 26 |
char a1() {return 5;} |
| 27 |
short a2(int i) {return short(i+1);} |
| 28 |
int a3() const {return 1;} |
| 29 |
double a4(unsigned i) const {return i-1;} |
| 30 |
}; |
| 31 |
|
| 32 |
int main(int, char**) |
| 33 |
{ |
| 34 |
A a; |
| 35 |
assert(std::mem_fun_ref(&A::a1)(a) == 5); |
| 36 |
|
| 37 |
return 0; |
| 38 |
} |