Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp1y/constexpr-84808.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
line wrap: on
line source
// PR c++/84808 // { dg-do compile { target c++14 } } struct A { int i; constexpr A () : i() {} }; struct B { A a[24]; }; constexpr int foo (int n) { B b; ++b.a[n + 20].i; ++b.a[n + 18].i; ++b.a[n + 16].i; ++b.a[n + 14].i; ++b.a[n + 12].i; ++b.a[n + 10].i; ++b.a[n + 8].i; ++b.a[n + 6].i; ++b.a[n + 4].i; ++b.a[n + 2].i; ++b.a[n].i; return b.a[2].i + b.a[4].i + b.a[6].i + b.a[8].i + b.a[10].i + b.a[12].i + b.a[14].i + b.a[16].i + b.a[18].i + b.a[20].i + b.a[22].i; } constexpr int i = foo (2); static_assert (i == 11, "");