| 1 |
// PR c/64279 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-Wduplicated-branches" } |
| 4 |
|
| 5 |
template <typename T> |
| 6 |
void |
| 7 |
f (signed char i, int *p) |
| 8 |
{ |
| 9 |
if (i) // { dg-warning "this condition has identical branches" "" { target short_eq_int } } |
| 10 |
*p = (signed short) i; |
| 11 |
else |
| 12 |
*p = (unsigned short) i; |
| 13 |
|
| 14 |
if (i) // { dg-warning "this condition has identical branches" } |
| 15 |
*p = (T) i; |
| 16 |
else |
| 17 |
*p = (unsigned short) i; |
| 18 |
} |
| 19 |
|
| 20 |
template void f<unsigned short>(signed char, int *); // { dg-message "required from here" } |
| 21 |
template void f<signed short>(signed char, int *); |