]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/friend.cpp
Updaet clang to 92395.
[FreeBSD/FreeBSD.git] / test / SemaCXX / friend.cpp
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
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}}
7
8 // PR5760
9 namespace test0 {
10   namespace ns {
11     void f(int);
12   }
13
14   struct A {
15     friend void ns::f(int a);
16   };
17 }
18
19 // Test derived from LLVM's Registry.h
20 namespace 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 }
32
33 // PR5476
34 namespace test2 {
35   namespace foo {
36     void Func(int x);
37   }
38
39   class Bar {
40     friend void ::test2::foo::Func(int x);
41   };
42 }
43
44 // PR5134
45 namespace test3 {
46   class Foo {
47     friend const int getInt(int inInt = 0);
48   };
49 }