Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/constinit9.C @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
line wrap: on
line source
// PR c++/91360 - Implement C++20 P1143R2: constinit // { dg-do run { target c++2a } } // A run-time test. constexpr int foo (int x) { return x; } constinit int b = foo(42); int main () { if (b != 42) __builtin_abort (); // We can still modify 'b'. b = 10; if (b != 10) __builtin_abort (); constinit static int s = foo(14); if (s != 14) __builtin_abort (); s++; if (s != 15) __builtin_abort (); }