1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 friend class A
; // expected-error {{'friend' used outside of class}}
4 void f() { friend class A
; } // expected-error {{'friend' used outside of class}}
5 class C
{ friend class A
; };
6 class D
{ void f() { friend class A
; } }; // expected-error {{'friend' used outside of class}}
15 friend void ns::f(int a
);
19 // Test derived from LLVM's Registry.h
21 template <class T
> struct Outer
{
24 friend void Outer::foo(T
);
29 (void) Outer
<int>::Inner();
40 friend void ::test2::foo::Func(int x
);
47 friend const int getInt(int inInt
= 0);
60 T4B
*mB
; // error here
66 namespace rdar8529993
{
67 struct A
{ ~A(); }; // expected-note {{nearly matches}}
71 template<int> friend A::~A(); // expected-error {{does not match}}
78 struct A1
{ friend void A(); };
80 struct B
{ friend void B(); };
93 vectorA(int i
, const A
& t
= A()) {}
103 vector(int i
, const T
& t
= T()) {}
108 friend class vector
<A
>;
120 void f(const T
& t
= T()) {}
125 friend void vector
<A
>::f(const A
&);