aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/temp/temp.decls/temp.friend/p1.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:50:08 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:50:08 +0000
commitc0c7bca4e5b8d12699dc93a0da49e9e4bb79671b (patch)
tree508d4388db78f87d35bf26a0400b4b03bc4c1f13 /test/CXX/temp/temp.decls/temp.friend/p1.cpp
parent4a37f65f1c1373c9956d118a012943de2f61edb0 (diff)
downloadsrc-c0c7bca4e5b8d12699dc93a0da49e9e4bb79671b.tar.gz
src-c0c7bca4e5b8d12699dc93a0da49e9e4bb79671b.zip
Notes
Diffstat (limited to 'test/CXX/temp/temp.decls/temp.friend/p1.cpp')
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p1.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
index 7a28e70c9ae6..f1b3c814c426 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only %s
+// RUN: %clang_cc1 -faccess-control -verify -emit-llvm-only %s
template <typename T> struct Num {
T value_;
@@ -54,3 +54,34 @@ int calc2() {
Num<int> result = x * n;
return result.get();
}
+
+// Reduced from GNU <locale>
+namespace test1 {
+ class A {
+ bool b; // expected-note {{declared private here}}
+ template <typename T> friend bool has(const A&);
+ };
+ template <typename T> bool has(const A &x) {
+ return x.b;
+ }
+ template <typename T> bool hasnot(const A &x) {
+ return x.b; // expected-error {{'b' is a private member of 'test1::A'}}
+ }
+}
+
+namespace test2 {
+ class A {
+ bool b; // expected-note {{declared private here}}
+ template <typename T> friend class HasChecker;
+ };
+ template <typename T> class HasChecker {
+ bool check(A *a) {
+ return a->b;
+ }
+ };
+ template <typename T> class HasNotChecker {
+ bool check(A *a) {
+ return a->b; // expected-error {{'b' is a private member of 'test2::A'}}
+ }
+ };
+}