| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-Wunused -W" } |
| 3 |
|
| 4 |
template <int N> |
| 5 |
long |
| 6 |
f1 (unsigned long long x) |
| 7 |
{ |
| 8 |
unsigned long long a = 1; |
| 9 |
const union { unsigned long long l; unsigned int p[2]; } b = { x }; |
| 10 |
const union { unsigned long long l; unsigned int p[2]; } c = { a }; |
| 11 |
return b.p[0] + c.p[0]; |
| 12 |
} |
| 13 |
|
| 14 |
template <int N> |
| 15 |
int |
| 16 |
f2 (int x, int y) |
| 17 |
{ |
| 18 |
int a = 1; |
| 19 |
int b[] = { 1, 2, x, a, 3, 4 }; |
| 20 |
return b[y]; |
| 21 |
} |
| 22 |
|
| 23 |
template <int N> |
| 24 |
int |
| 25 |
f3 (int a) // { dg-warning "unused parameter" } |
| 26 |
{ |
| 27 |
return 0; |
| 28 |
} |
| 29 |
|
| 30 |
template <int N> |
| 31 |
int |
| 32 |
f4 (int a) // { dg-warning "set but not used" } |
| 33 |
{ |
| 34 |
a = 1; |
| 35 |
return 0; |
| 36 |
} |
| 37 |
|
| 38 |
template <int N> |
| 39 |
int |
| 40 |
f5 (int a) |
| 41 |
{ |
| 42 |
a = 1; |
| 43 |
return a; |
| 44 |
} |
| 45 |
|
| 46 |
void |
| 47 |
test () |
| 48 |
{ |
| 49 |
(void) f1<0> (0); |
| 50 |
(void) f2<0> (0, 0); |
| 51 |
(void) f3<0> (0); |
| 52 |
(void) f4<0> (0); |
| 53 |
(void) f5<0> (0); |
| 54 |
} |