Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated4.C

raw
1 // P0595R2
2 // { dg-do compile { target c++14 } }
3
4 namespace std {
5 constexpr inline bool
6 is_constant_evaluated () noexcept
7 {
8 return __builtin_is_constant_evaluated ();
9 }
10 }
11
12 constexpr int
13 foo () noexcept
14 {
15 return std::is_constant_evaluated () ? 5 : 12;
16 }
17
18 static_assert (std::is_constant_evaluated (), "");
19 static_assert (foo () == 5, "");