This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/85977] Incorrect handling of array reference size deduction
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 May 2018 20:47:46 +0000
- Subject: [Bug c++/85977] Incorrect handling of array reference size deduction
- Auto-submitted: auto-generated
- References: <bug-85977-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85977
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
// PR c++/85977, Incorrect handling of array reference size deduction
// { dg-do compile { target c++11 } }
template <int N>
void fn1 (const char (&)[N]) { static_assert (N == 3, "fn1");}
template <int N>
void fn2 (const short (&)[N]) { static_assert (N == 3, "fn2");}
template <int N>
void fn3 (const int (&)[N]) { static_assert (N == 3, "fn2");}
template <int N>
void fn4 (const long (&)[N]) { static_assert (N == 3, "fn4");}
template <int N>
void fn5 (const unsigned char (&)[N]) { static_assert (N == 3, "fn5");}
template <int N>
void fn6 (const unsigned short (&)[N]) { static_assert (N == 3, "fn6");}
template <int N>
void fn7 (const unsigned int (&)[N]) { static_assert (N == 3, "fn7");}
template <int N>
void fn8 (const unsigned int (&)[N]) { static_assert (N == 3, "fn8");}
void
bar ()
{
fn1 ({1, 2, 3});
fn2 ({1, 2, 3});
fn3 ({1, 2, 3});
fn4 ({1, 2, 3});
fn5 ({1, 2, 3});
fn6 ({1, 2, 3});
fn7 ({1, 2, 3});
fn8 ({1, 2, 3});
}