Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated4.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
rev | line source |
---|---|
145 | 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, ""); |