1// { dg-do compile } 2 3// Origin: Ivan Godard <igodard@pacbell.net> 4 5// PR c++/15410: Declaration of friend class template with wrong 6// template parameter. 7 8template <typename T, typename U> struct F; // { dg-message "previous declaration" } 9 10class W 11{ 12 template<int i> friend class F; // { dg-error "template parameter" } 13 int x; // { dg-error "private" } 14}; 15 16template <typename T, typename U> struct F 17{ 18 void Look(W& w) { w.x = 3; } // { dg-error "within this context" } 19}; 20 21int main() 22{ 23 W w; 24 F<char, bool> f; 25 f.Look(w); 26 return 0; 27} 28