xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/friend-template.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test this without pch.
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include %s -fsyntax-only -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // Test with pch.
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-pch -o %t %s
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc // expected-no-diagnostics
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc #ifndef HEADER
11*f4a2713aSLionel Sambuc #define HEADER
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc // rdar://12627738
14*f4a2713aSLionel Sambuc namespace rdar12627738 {
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc class RecyclerTag {
17*f4a2713aSLionel Sambuc     template <typename T> friend class Recycler;
18*f4a2713aSLionel Sambuc };
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc #else
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc namespace rdar12627738 {
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc template<typename TTag>
27*f4a2713aSLionel Sambuc class CRN {
28*f4a2713aSLionel Sambuc     template <typename T> friend class Recycler;
29*f4a2713aSLionel Sambuc };
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc template<typename T>
33*f4a2713aSLionel Sambuc class Recycler {
34*f4a2713aSLionel Sambuc public:
35*f4a2713aSLionel Sambuc     Recycler ();
36*f4a2713aSLionel Sambuc };
37*f4a2713aSLionel Sambuc 
38*f4a2713aSLionel Sambuc 
39*f4a2713aSLionel Sambuc template<typename T>
Recycler()40*f4a2713aSLionel Sambuc Recycler<T>::Recycler ()
41*f4a2713aSLionel Sambuc {
42*f4a2713aSLionel Sambuc }
43*f4a2713aSLionel Sambuc 
44*f4a2713aSLionel Sambuc }
45*f4a2713aSLionel Sambuc 
46*f4a2713aSLionel Sambuc #endif
47