cxx-member-init.cpp 645 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Test this without pch.
  2. // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -DSOURCE -fsyntax-only -emit-llvm -o - %s
  3. // Test with pch.
  4. // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -o %t %s
  5. // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -fsyntax-only -emit-llvm -o - %s
  6. #ifdef HEADER
  7. int n;
  8. struct S {
  9. int *p = &m;
  10. int &m = n;
  11. S *that = this;
  12. };
  13. template<typename T> struct X { T t {0}; };
  14. struct v_t { };
  15. struct m_t
  16. {
  17. struct { v_t v; };
  18. m_t() { }
  19. };
  20. #endif
  21. #ifdef SOURCE
  22. S s;
  23. struct E { explicit E(int); };
  24. X<E> x;
  25. m_t *test() {
  26. return new m_t;
  27. }
  28. #elif HEADER
  29. #undef HEADER
  30. #define SOURCE
  31. #endif