| 1 |
// { dg-do assemble } |
| 2 |
|
| 3 |
// Origin: David Margery <[email protected]> |
| 4 |
|
| 5 |
// Bug: We fail to set DECL_TEMPLATE_PARM_P when reducing template |
| 6 |
// parameter level. |
| 7 |
|
| 8 |
template <class T> class A2 { |
| 9 |
public: |
| 10 |
A2() {} |
| 11 |
virtual ~A2() {} |
| 12 |
template <class other> A2 & operator=(const A2<other> o) { |
| 13 |
i=o.i; |
| 14 |
return *this; |
| 15 |
} |
| 16 |
T i; |
| 17 |
T j; |
| 18 |
}; |
| 19 |
|
| 20 |
template <class T> class A1 { |
| 21 |
public: |
| 22 |
A1() {} |
| 23 |
virtual ~A1() {} |
| 24 |
template <class other> A1 & operator=(const A1<other> o) { |
| 25 |
i=o.i; |
| 26 |
return *this; |
| 27 |
} |
| 28 |
template <class other> A1 & operator=(const A2<other> o) { |
| 29 |
i=o.i; |
| 30 |
return *this; |
| 31 |
} |
| 32 |
T i; |
| 33 |
}; |
| 34 |
|
| 35 |
template <template <class U> class T> class B { |
| 36 |
public: |
| 37 |
B(){} |
| 38 |
virtual ~B(){} |
| 39 |
template <template <class U2> class O> struct rebind { typedef B<O> other ;}; |
| 40 |
template <template <class U2> class O> B & operator=(const B<O> o) { |
| 41 |
i=o.i; |
| 42 |
return *this; |
| 43 |
} |
| 44 |
T<int> i; |
| 45 |
}; |
| 46 |
|
| 47 |
int main(int argc, char *argv[]) { |
| 48 |
|
| 49 |
A1<int> a1; |
| 50 |
A1<long> a2; |
| 51 |
a1=a2; |
| 52 |
|
| 53 |
B<A1 > b1; |
| 54 |
B<A2 > b2; |
| 55 |
b1=b2; |
| 56 |
|
| 57 |
return 0; |
| 58 |
} |