| 1 |
// PR 87531 part 2. dependent using decls + template decls. |
| 2 |
|
| 3 |
template<typename T> |
| 4 |
struct One |
| 5 |
{ |
| 6 |
One& operator=(T* p_) |
| 7 |
{ |
| 8 |
return operator=<T>(p_); // Parse failed here |
| 9 |
} |
| 10 |
|
| 11 |
template<typename U> |
| 12 |
One& operator=(U* p_); |
| 13 |
|
| 14 |
}; |
| 15 |
|
| 16 |
|
| 17 |
template<typename T> |
| 18 |
struct Two : T |
| 19 |
{ |
| 20 |
using T::f; |
| 21 |
template<typename U> void f (); |
| 22 |
|
| 23 |
using T::operator T*; |
| 24 |
operator T * () const; |
| 25 |
|
| 26 |
int frob () |
| 27 |
{ |
| 28 |
return f<int> (1); |
| 29 |
} |
| 30 |
|
| 31 |
T *quux () |
| 32 |
{ |
| 33 |
return operator T * (); |
| 34 |
} |
| 35 |
|
| 36 |
T *quux () const |
| 37 |
{ |
| 38 |
return operator T * (); |
| 39 |
} |
| 40 |
}; |
| 41 |
|
| 42 |
struct Base |
| 43 |
{ |
| 44 |
template <typename T> int f (T i) |
| 45 |
{ |
| 46 |
return i; |
| 47 |
} |
| 48 |
|
| 49 |
operator Base *() const; |
| 50 |
}; |
| 51 |
|
| 52 |
void foo () |
| 53 |
{ |
| 54 |
One<int> one; |
| 55 |
Two<Base> two; |
| 56 |
|
| 57 |
one = One<int> (); |
| 58 |
|
| 59 |
two.frob (); |
| 60 |
two.quux (); |
| 61 |
const_cast <const Two<Base> &> (two).quux (); |
| 62 |
} |
| 63 |
|