This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/85977] Incorrect handling of array reference size deduction


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});
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]