| 1 |
// PR c++/44148 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "" } |
| 4 |
// { dg-options "-fpic" { target fpic } } |
| 5 |
// { dg-additional-options "-Wno-return-type" } |
| 6 |
|
| 7 |
template <typename T> struct S2 |
| 8 |
{ |
| 9 |
typedef const T &t2; |
| 10 |
t2 operator* () const {} |
| 11 |
}; |
| 12 |
template <typename T> struct S3 |
| 13 |
{ |
| 14 |
typedef S2 <T> t5; |
| 15 |
}; |
| 16 |
template <typename T1, typename T2> T2 foo1 (T1 x, T2 y) { y (*x); } |
| 17 |
template <class T> struct S4 |
| 18 |
{ |
| 19 |
T &operator* () const; |
| 20 |
}; |
| 21 |
struct S7 {}; |
| 22 |
struct S8 |
| 23 |
{ |
| 24 |
typedef::S3 <S4 <S7> >::t5 t6; |
| 25 |
t6 m1 () const; |
| 26 |
}; |
| 27 |
template <class T> struct S9 |
| 28 |
{ |
| 29 |
typedef T t3; |
| 30 |
inline t3 &operator[] (unsigned int) {} |
| 31 |
}; |
| 32 |
template <typename T1, typename T2, typename T3, void (&T4) (const T1 &, T3 &)> struct S10 |
| 33 |
{ |
| 34 |
S10 (T2 &x, unsigned int y = 0) : u (x), v (y) {} |
| 35 |
void operator () (const S4 <T1> &x) { T4 (*x, u[v++]); } |
| 36 |
T2 &u; |
| 37 |
unsigned int v; |
| 38 |
}; |
| 39 |
struct S15; |
| 40 |
struct S11 |
| 41 |
{ |
| 42 |
static void m3 (const S8 &, S15 &); |
| 43 |
}; |
| 44 |
struct S16; |
| 45 |
struct S12; |
| 46 |
struct S13 |
| 47 |
{ |
| 48 |
static void m4 (const S7 &,S16 &); |
| 49 |
}; |
| 50 |
typedef S10 <S7, S12, S16, S13::m4> t10; |
| 51 |
struct S12: S9 <S16> |
| 52 |
{ |
| 53 |
}; |
| 54 |
struct S15 |
| 55 |
{ |
| 56 |
S12 p; |
| 57 |
}; |
| 58 |
void S11::m3 (const S8 &x, S15 &y) |
| 59 |
{ |
| 60 |
foo1 (x.m1 (), t10 (y.p)); |
| 61 |
} |