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