blob: dc13570718b480669d1ffed4f3346f2db64ec7a6 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Anders Carlsson38811702009-05-11 22:55:49 +00002
3friend class A; // expected-error {{'friend' used outside of class}}
4void f() { friend class A; } // expected-error {{'friend' used outside of class}}
5class C { friend class A; };
6class D { void f() { friend class A; } }; // expected-error {{'friend' used outside of class}}
John McCall2b058ef2009-12-11 20:04:54 +00007
8// PR5760
9namespace test0 {
10 namespace ns {
11 void f(int);
12 }
13
14 struct A {
15 friend void ns::f(int a);
16 };
17}
John McCall90d3bb92009-12-17 23:21:11 +000018
19// Test derived from LLVM's Registry.h
20namespace test1 {
21 template <class T> struct Outer {
22 void foo(T);
23 struct Inner {
24 friend void Outer::foo(T);
25 };
26 };
27
28 void test() {
29 (void) Outer<int>::Inner();
30 }
31}