blob: 65e0da761cfd4ab4ceebde1e4e2a7bd89e43bba2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
friend class A; // expected-error {{'friend' used outside of class}}
void f() { friend class A; } // expected-error {{'friend' used outside of class}}
class C { friend class A; };
class D { void f() { friend class A; } }; // expected-error {{'friend' used outside of class}}
// PR5760
namespace test0 {
namespace ns {
void f(int);
}
struct A {
friend void ns::f(int a);
};
}
// Test derived from LLVM's Registry.h
namespace test1 {
template <class T> struct Outer {
void foo(T);
struct Inner {
friend void Outer::foo(T);
};
};
void test() {
(void) Outer<int>::Inner();
}
}
// PR5476
namespace test2 {
namespace foo {
void Func(int x);
}
class Bar {
friend void ::test2::foo::Func(int x);
};
}
// PR5134
namespace test3 {
class Foo {
friend const int getInt(int inInt = 0); // expected-warning{{'const' type qualifier on return type has no effect}}
};
}
namespace test4 {
class T4A {
friend class T4B;
public:
T4A(class T4B *);
protected:
T4B *mB; // error here
};
class T4B {};
}
|