| 1 |
// PR c++/85977, Incorrect handling of array reference size deduction |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <int N> |
| 5 |
void fn1 (const char (&)[N]) { static_assert (N == 3, "fn1");} |
| 6 |
|
| 7 |
template <int N> |
| 8 |
void fn2 (const short (&)[N]) { static_assert (N == 3, "fn2");} |
| 9 |
|
| 10 |
template <int N> |
| 11 |
void fn3 (const int (&)[N]) { static_assert (N == 3, "fn2");} |
| 12 |
|
| 13 |
template <int N> |
| 14 |
void fn4 (const long (&)[N]) { static_assert (N == 3, "fn4");} |
| 15 |
|
| 16 |
template <int N> |
| 17 |
void fn5 (const unsigned char (&)[N]) { static_assert (N == 3, "fn5");} |
| 18 |
|
| 19 |
template <int N> |
| 20 |
void fn6 (const unsigned short (&)[N]) { static_assert (N == 3, "fn6");} |
| 21 |
|
| 22 |
template <int N> |
| 23 |
void fn7 (const unsigned int (&)[N]) { static_assert (N == 3, "fn7");} |
| 24 |
|
| 25 |
template <int N> |
| 26 |
void fn8 (const unsigned int (&)[N]) { static_assert (N == 3, "fn8");} |
| 27 |
|
| 28 |
void |
| 29 |
bar () |
| 30 |
{ |
| 31 |
fn1 ({1, 2, 3}); |
| 32 |
fn2 ({1, 2, 3}); |
| 33 |
fn3 ({1, 2, 3}); |
| 34 |
fn4 ({1, 2, 3}); |
| 35 |
fn5 ({1, 2, 3}); |
| 36 |
fn6 ({1, 2, 3}); |
| 37 |
fn7 ({1, 2, 3}); |
| 38 |
fn8 ({1, 2, 3}); |
| 39 |
} |