1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template<Returnable R, class T, CopyConstructible... Args>
12 // unspecified mem_fn(R (T::* pm)(Args...) volatile);
17 #include "test_macros.h"
21 char test0() volatile {return 'a';}
22 char test1(int) volatile {return 'b';}
23 char test2(int, double) volatile {return 'c';}
36 assert(f(cap
) == 'a');
38 assert(cf(ap
) == 'a');
48 assert(f(a
, 1) == 'b');
50 assert(f(ap
, 2) == 'b');
52 assert(f(cap
, 2) == 'b');
54 assert(cf(ap
, 2) == 'b');
64 assert(f(a
, 1, 2) == 'c');
66 assert(f(ap
, 2, 3.5) == 'c');
68 assert(f(cap
, 2, 3.5) == 'c');
70 assert(cf(ap
, 2, 3.5) == 'c');
76 test0(std::mem_fn(&A::test0
));
77 test1(std::mem_fn(&A::test1
));
78 test2(std::mem_fn(&A::test2
));