diff options
Diffstat (limited to 'test/CXX/temp/temp.decls/temp.friend/p1.cpp')
-rw-r--r-- | test/CXX/temp/temp.decls/temp.friend/p1.cpp | 39 |
1 files changed, 39 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 073b2a1463544..578de2952d944 100644 --- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp @@ -293,3 +293,42 @@ namespace test13 { template class Foo<0>; } + +namespace test14 { + template <class T> class B; + template <class T> class A { + friend void B<T>::foo(); + static void foo(); // expected-note {{declared private here}} + }; + + template <class T> class B { + void foo() { return A<long>::foo(); } // expected-error {{'foo' is a private member of 'test14::A<long>'}} + }; + + template class B<int>; // expected-note {{in instantiation}} +} + +namespace test15 { + template <class T> class B; + template <class T> class A { + friend void B<T>::foo(); + + // This shouldn't be misrecognized as a templated-scoped reference. + template <class U> friend void B<T>::bar(U); + + static void foo(); // expected-note {{declared private here}} + }; + + template <class T> class B { + void foo() { return A<long>::foo(); } // expected-error {{'foo' is a private member of 'test15::A<long>'}} + }; + + template <> class B<float> { + void foo() { return A<float>::foo(); } + template <class U> void bar(U u) { + (void) A<float>::foo(); + } + }; + + template class B<int>; // expected-note {{in instantiation}} +} |