friend-template.cpp 633 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Test this without pch.
  2. // RUN: %clang_cc1 -include %s -fsyntax-only -verify %s
  3. // Test with pch.
  4. // RUN: %clang_cc1 -emit-pch -o %t %s
  5. // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
  6. // expected-no-diagnostics
  7. #ifndef HEADER
  8. #define HEADER
  9. // rdar://12627738
  10. namespace rdar12627738 {
  11. class RecyclerTag {
  12. template <typename T> friend class Recycler;
  13. };
  14. }
  15. #else
  16. namespace rdar12627738 {
  17. template<typename TTag>
  18. class CRN {
  19. template <typename T> friend class Recycler;
  20. };
  21. template<typename T>
  22. class Recycler {
  23. public:
  24. Recycler ();
  25. };
  26. template<typename T>
  27. Recycler<T>::Recycler ()
  28. {
  29. }
  30. }
  31. #endif