aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.6/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.C
blob: 17dd6e50be91bd4d846c45557a174dfc9289984f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// { dg-options "-std=c++0x" }

typedef decltype(sizeof(char)) size_type;

template<class T, size_type N>
constexpr size_type size(T (&)[N]) { return N; }

double array_double[] = { 1.0, 2.0, 3.0 };

constexpr auto sz_d = size(array_double);

static_assert(sz_d == 3, "Array size failure");

void f(bool (&param)[2]) {
  static_assert(size(param) == 2, "Array size failure"); // Line 13
  short data[] = {-1, 2, -45, 6, 88, 99, -345};
  static_assert(size(data) == 7, "Array size failure");
}