[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / utilities / function.objects / func.memfn / member_data.compile.fail.cpp
blobf68b019b80b996fde6dcda00f61f0c1def27d2dc
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 //===----------------------------------------------------------------------===//
10 // <functional>
12 // template<Returnable R, class T> unspecified mem_fn(R T::* pm);
14 #include <functional>
15 #include <cassert>
17 struct A
19 double data_;
22 template <class F>
23 void
24 test(F f)
27 A a;
28 f(a) = 5;
29 assert(a.data_ == 5);
30 A* ap = &a;
31 f(ap) = 6;
32 assert(a.data_ == 6);
33 const A* cap = ap;
34 assert(f(cap) == f(ap));
35 f(cap) = 7;
39 int main(int, char**)
41 test(std::mem_fn(&A::data_));
43 return 0;