| 1 |
// PR c++/104379 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-Wshadow" } |
| 4 |
|
| 5 |
int x; |
| 6 |
|
| 7 |
template<typename T> |
| 8 |
struct S |
| 9 |
{ |
| 10 |
int i; |
| 11 |
S(int i) { (void) i; } // { dg-warning "declaration of 'i' shadows a member of 'S<T>'" } |
| 12 |
S(float x) { (void) x; } // { dg-warning "declaration of 'x' shadows a global declaration" } |
| 13 |
S(int *p) { int a = 1; (void) p; (void) a; |
| 14 |
{ int a = 2; (void) a; } } // { dg-warning "declaration of 'a' shadows a previous local" } |
| 15 |
}; |
| 16 |
|
| 17 |
S<int> i(1); |
| 18 |
S<long> j(1); |
| 19 |
S<int> k(1.0f); |
| 20 |
S<long> l(1.0f); |
| 21 |
S<int> m(&x); |
| 22 |
S<int> n(&x); |