view gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line source

// { dg-do compile { target c++14 } }

struct A
{
  int i;
};

constexpr bool f()
{
  A ar[4] = { 1, 2, 3, 4 };
  A *ap = ar;
  int i = 0;
  do
    *ap++ = A{i};
  while (++i < 3);
  return (ar[0].i == 0
	  && ar[1].i == 1
	  && ar[2].i == 2
	  && ar[3].i == 4);
}

#define SA(X) static_assert((X),#X)
SA(f());