xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/friend.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<typename T> struct A {
3   struct B { };
4 
5   friend struct B;
6 };
7 
f()8 void f() {
9   A<int>::B b;
10 }
11 
12 struct C0 {
13   friend struct A<int>;
14 };
15 
16 namespace PR6770 {
17   namespace N {
18     int f1(int);
19   }
20   using namespace N;
21 
22   namespace M {
23     float f1(float);
24   }
25   using M::f1;
26 
27   template<typename T> void f1(T, T);
28   template <class T>
f()29   void f() {
30     friend class f; // expected-error{{'friend' used outside of class}}
31     friend class f1; // expected-error{{'friend' used outside of class}}
32   }
33 }
34