| 1 |
// { dg-do assemble } |
| 2 |
|
| 3 |
// Here we declare ::S |
| 4 |
typedef struct s1 *S; |
| 5 |
|
| 6 |
struct s1 |
| 7 |
{ |
| 8 |
int s; |
| 9 |
}; |
| 10 |
|
| 11 |
struct A |
| 12 |
{ |
| 13 |
// Here we declare A::S |
| 14 |
typedef struct s1 *S; |
| 15 |
}; |
| 16 |
|
| 17 |
template<class T, class U> class XX; |
| 18 |
|
| 19 |
template<class T, class U> |
| 20 |
class X |
| 21 |
{ |
| 22 |
public: |
| 23 |
static T *do_something (); |
| 24 |
friend class T; // { dg-error "" } `T' is a template parameter |
| 25 |
friend class XX<T, U>; |
| 26 |
}; |
| 27 |
|
| 28 |
struct N |
| 29 |
{ |
| 30 |
// Here we declare N::S |
| 31 |
class S |
| 32 |
{ |
| 33 |
}; |
| 34 |
|
| 35 |
// Should use N::S and A::S. |
| 36 |
typedef X<S, A::S> X_S; |
| 37 |
|
| 38 |
void bug (); |
| 39 |
}; |
| 40 |
|
| 41 |
void |
| 42 |
N::bug () |
| 43 |
{ |
| 44 |
// X_S is template class X<N::S, A::S> |
| 45 |
// `s' is N::S. |
| 46 |
S *s = X_S::do_something (); |
| 47 |
} |
| 48 |
|