// PR c++/34399 template struct X { void foo(); }; struct Y { template friend void X::X::foo(); // { dg-error "declared as friend" } };