fixit-pmem.cpp 545 B

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