Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp0x/constexpr-fwctor1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // PR c++/66450 |
2 // { dg-do compile { target c++11 } } | |
3 | |
4 struct foo { | |
5 constexpr foo(int a); | |
6 constexpr foo(int a, int b, int c): a{a}, b{b}, c{c} {} | |
7 | |
8 int a, b, c; | |
9 }; | |
10 | |
11 constexpr foo make_foo(int a) { return foo{a, a+1, a+2}; } | |
12 constexpr foo::foo(int a): foo{make_foo(a)} {} | |
13 | |
14 int main() { | |
15 constexpr const foo f{3}; | |
16 static_assert(f.a == 3, ""); | |
17 static_assert(f.b == 4, ""); | |
18 static_assert(f.c == 5, ""); | |
19 } |