p5.cpp revision 337ec3d0e8cb24a591ecbecdc0a995a167f6af01
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3namespace test0 {
4  template <class T> class A {
5    class Member {};
6  };
7
8  class B {
9    template <class T> friend class A<T>::Member;
10  };
11
12  A<int> a;
13  B b;
14}
15
16// rdar://problem/8204127
17namespace test1 {
18  template <class T> struct A;
19
20  class C {
21    static void foo();
22    template <class T> friend void A<T>::f();
23  };
24
25  template <class T> struct A {
26    void f() { C::foo(); }
27  };
28
29  template <class T> struct A<T*> {
30    void f() { C::foo(); }
31  };
32
33  template <> struct A<char> {
34    void f() { C::foo(); }
35  };
36}
37
38// FIXME: these should fail!
39namespace test2 {
40  template <class T> struct A;
41
42  class C {
43    static void foo();
44    template <class T> friend void A<T>::g();
45  };
46
47  template <class T> struct A {
48    void f() { C::foo(); }
49  };
50
51  template <class T> struct A<T*> {
52    void f() { C::foo(); }
53  };
54
55  template <> struct A<char> {
56    void f() { C::foo(); }
57  };
58}
59