1// { dg-do compile } 2 3// Copyright (C) 2002 Free Software Foundation, Inc. 4// Contributed by Nathan Sidwell 18 Dec 2001 <nathan@codesourcery.com> 5 6// PR 109, dependent member friends 7 8struct B 9{ 10 static int foo (); 11 struct N 12 { 13 static int bar (); 14 }; 15}; 16 17 18template <class T> 19class A 20{ 21 friend int T::foo (); 22 friend int T::N::bar (); 23 24 private: 25 static int m; 26}; 27 28template <class T> 29class C 30{ 31 friend struct T::N; 32 33 private: 34 static int m; 35}; 36 37 38int B::foo () 39{ 40 return A<B>::m; 41} 42 43int B::N::bar () 44{ 45 return A<B>::m + C<B>::m; 46} 47