Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/constinit9.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
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 (); }