Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const23.C @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
rev | line source |
---|---|
152 | 1 // PR c++/94772 |
2 // { dg-do compile { target c++14 } } | |
3 | |
4 struct foo | |
5 { | |
6 int x{}; | |
7 | |
8 constexpr foo() noexcept = default; | |
9 | |
10 constexpr foo(int a) : foo{} | |
11 { x = -a; } | |
12 | |
13 constexpr foo(int a, int b) : foo{a} | |
14 { x += a + b; } | |
15 }; | |
16 | |
17 int main() | |
18 { | |
19 constexpr foo bar{1, 2}; | |
20 static_assert(bar.x == 2, ""); | |
21 } |