Mercurial > hg > CbC > CbC_gcc
comparison 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 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 // PR c++/84808 | |
2 // { dg-do compile { target c++14 } } | |
3 | |
4 struct A { int i; constexpr A () : i() {} }; | |
5 struct B { A a[24]; }; | |
6 | |
7 constexpr int | |
8 foo (int n) | |
9 { | |
10 B b; | |
11 ++b.a[n + 20].i; | |
12 ++b.a[n + 18].i; | |
13 ++b.a[n + 16].i; | |
14 ++b.a[n + 14].i; | |
15 ++b.a[n + 12].i; | |
16 ++b.a[n + 10].i; | |
17 ++b.a[n + 8].i; | |
18 ++b.a[n + 6].i; | |
19 ++b.a[n + 4].i; | |
20 ++b.a[n + 2].i; | |
21 ++b.a[n].i; | |
22 return b.a[2].i + b.a[4].i + b.a[6].i + b.a[8].i + b.a[10].i | |
23 + b.a[12].i + b.a[14].i + b.a[16].i + b.a[18].i + b.a[20].i + b.a[22].i; | |
24 } | |
25 | |
26 constexpr int i = foo (2); | |
27 static_assert (i == 11, ""); |