diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CXX/temp/temp.decls/temp.friend/p1.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp index c9dc5460a0..57c71027b6 100644 --- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp @@ -216,3 +216,25 @@ namespace test9 { template class A<int>; // expected-note {{in instantiation}} } + +namespace test10 { + template <class T> class A; + template <class T> A<T> bar(const T*, const A<T>&); + template <class T> class A { + private: + void foo(); // expected-note {{declared private here}} + friend A bar<>(const T*, const A<T>&); + }; + + template <class T> A<T> bar(const T *l, const A<T> &r) { + A<T> l1; + l1.foo(); + + A<char> l2; + l2.foo(); // expected-error {{'foo' is a private member of 'test10::A<char>'}} + + return l1; + } + + template A<int> bar<int>(const int *, const A<int> &); // expected-note {{in instantiation}} +} |