xref: /aosp_15_r20/external/clang/test/FixIt/fixit-pmem.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: cp %s %t
2*67e74705SXin Li // RUN: %clang_cc1 -pedantic -fixit -x c++ %t
3*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ %t
4*67e74705SXin Li // XFAIL: *
5*67e74705SXin Li 
6*67e74705SXin Li /* This is a test of the various code modification hints that are
7*67e74705SXin Li    provided as part of warning or extension diagnostics. All of the
8*67e74705SXin Li    warnings will be fixed by -fixit, and the resulting file should
9*67e74705SXin Li    compile cleanly with -Werror -pedantic. */
10*67e74705SXin Li 
11*67e74705SXin Li struct  S {
12*67e74705SXin Li 	int i;
13*67e74705SXin Li };
14*67e74705SXin Li 
foo(int S::* ps,S s,S * p)15*67e74705SXin Li int foo(int S::* ps, S s, S* p)
16*67e74705SXin Li {
17*67e74705SXin Li   p.*ps = 1;
18*67e74705SXin Li   return s->*ps;
19*67e74705SXin Li }
20*67e74705SXin Li 
foo1(int (S::* ps)(),S s,S * p)21*67e74705SXin Li void foo1(int (S::*ps)(), S s, S* p)
22*67e74705SXin Li {
23*67e74705SXin Li   (p.*ps)();
24*67e74705SXin Li   (s->*ps)();
25*67e74705SXin Li }
26*67e74705SXin Li 
27