view gcc/testsuite/g++.dg/cpp0x/initlist102.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line source

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