================ @@ -373,6 +373,98 @@ namespace cwg1837 { // cwg1837: 3.3 #endif } +namespace cwg1862 { // cwg1862: no +template<class T> +struct A { + struct B { + void e(); + }; + + void f(); + + struct D { + void g(); + }; + + T h(); + + template<T U> + T i(); +}; + +template<> +struct A<int> { + struct B { + void e(); + }; + + int f(); + + struct D { + void g(); + }; + + template<int U> + int i(); +}; + +template<> +struct A<float*> { + int* h(); +}; + +class C { + int private_int; + + template<class T> + friend struct A<T>::B; + // expected-warning@-1 {{dependent nested name specifier 'A<T>::' for friend class declaration is not supported; turning off access control for 'C'}} + + template<class T> + friend void A<T>::f(); + // expected-warning@-1 {{dependent nested name specifier 'A<T>::' for friend class declaration is not supported; turning off access control for 'C'}} + + // FIXME: this is ill-formed, because A<T>::D does not end with a simple-template-id + template<class T> + friend void A<T>::D::g(); + // expected-warning@-1 {{dependent nested name specifier 'A<T>::D::' for friend class declaration is not supported; turning off access control for 'C'}} + + template<class T> + friend int *A<T*>::h(); + // expected-warning@-1 {{dependent nested name specifier 'A<T *>::' for friend class declaration is not supported; turning off access control for 'C'}} + + template<class T> + template<T U> + friend T A<T>::i(); + // expected-warning@-1 {{dependent nested name specifier 'A<T>::' for friend class declaration is not supported; turning off access control for 'C'}} +}; + +C c; + +template<class T> +void A<T>::B::e() { (void)c.private_int; } ---------------- shafik wrote:
I guess these work b/c as the diagnostic above said "we turn off access control"? https://github.com/llvm/llvm-project/pull/94288 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits