aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/class.access/p6.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/class.access/p6.cpp')
-rw-r--r--test/CXX/class.access/p6.cpp69
1 files changed, 68 insertions, 1 deletions
diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp
index aaf510a6d11f..734a4d8c4869 100644
--- a/test/CXX/class.access/p6.cpp
+++ b/test/CXX/class.access/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x [class.access]p6:
// All access controls in [class.access] affect the ability to
@@ -52,3 +52,70 @@ namespace test1 {
A apriv = priv; // expected-error {{private constructor}}
}
}
+
+// PR6967
+namespace test2 {
+ class A {
+ public:
+ template <class T> static void set(T &t, typename T::type v) {
+ t.value = v;
+ }
+ template <class T> static typename T::type get(const T &t) {
+ return t.value;
+ }
+ };
+
+ class B {
+ friend class A;
+
+ private:
+ typedef int type;
+ type value;
+ };
+
+ int test() {
+ B b;
+ A::set(b, 0);
+ return A::get(b);
+ }
+}
+
+namespace test3 {
+ class Green {}; class Blue {};
+
+ // We have to wrap this in a class because a partial specialization
+ // isn't actually in the context of the template.
+ struct Outer {
+ template <class T, class Nat> class A {
+ };
+ };
+
+ template <class T> class Outer::A<T, typename T::nature> {
+ public:
+ static void foo();
+ };
+
+ class B {
+ private: typedef Green nature;
+ friend class Outer;
+ };
+
+ void test() {
+ Outer::A<B, Green>::foo();
+ Outer::A<B, Blue>::foo(); // expected-error {{no member named 'foo'}}
+ }
+}
+
+namespace test4 {
+ template <class T> class A {
+ private: typedef int type;
+ template <class U> friend void foo(U &, typename U::type);
+ };
+
+ template <class U> void foo(U &, typename U::type) {}
+
+ void test() {
+ A<int> a;
+ foo(a, 0);
+ }
+}