| 1 |
// PR c++/58878 |
| 2 |
|
| 3 |
// Template-members of non-template class |
| 4 |
struct A |
| 5 |
{ |
| 6 |
template <typename t> // { dg-message "template parameter" } |
| 7 |
void f() |
| 8 |
{ |
| 9 |
int t = 1; // { dg-error "shadows" } |
| 10 |
} |
| 11 |
|
| 12 |
template <typename t> |
| 13 |
void g(); |
| 14 |
}; |
| 15 |
|
| 16 |
template <typename t> // { dg-message "template parameter" } |
| 17 |
void A::g() |
| 18 |
{ |
| 19 |
int t = 2; // { dg-error "shadows" } |
| 20 |
} |
| 21 |
|
| 22 |
// (Non-template) Members of template class |
| 23 |
template <typename t> // { dg-message "template parameter" } |
| 24 |
struct B |
| 25 |
{ |
| 26 |
void f() |
| 27 |
{ |
| 28 |
int t = 3; // { dg-error "shadows" } |
| 29 |
} |
| 30 |
|
| 31 |
void g(); |
| 32 |
}; |
| 33 |
|
| 34 |
template <typename t> // { dg-message "template parameter" } |
| 35 |
void B<t>::g() |
| 36 |
{ |
| 37 |
int t = 4; // { dg-error "shadows" } |
| 38 |
} |
| 39 |
|
| 40 |
// Template members of template class |
| 41 |
template <typename t> // { dg-message "template parameter" } |
| 42 |
struct C |
| 43 |
{ |
| 44 |
template <typename s> // { dg-message "template parameter" } |
| 45 |
void f() |
| 46 |
{ |
| 47 |
int t = 5; // { dg-error "shadows" } |
| 48 |
int s = 6; // { dg-error "shadows" } |
| 49 |
} |
| 50 |
|
| 51 |
template <typename s> |
| 52 |
void g(); |
| 53 |
}; |
| 54 |
|
| 55 |
template <typename t> // { dg-message "template parameter" } |
| 56 |
template <typename s> // { dg-message "template parameter" } |
| 57 |
void C<t>::g() |
| 58 |
{ |
| 59 |
int t = 7; // { dg-error "shadows" } |
| 60 |
int s = 8; // { dg-error "shadows" } |
| 61 |
} |