// PR c++/109923 template struct A { private: int x; public: A() : x(0) { } friend void non_templ_friend(A val, A weird) { val.x++; // always works weird.x++; // { dg-error "private" } should only work when T=void } }; int main() { non_templ_friend(A(), A()); // { dg-bogus "" } non_templ_friend(A(), A()); // { dg-message "required from here" } }