Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated4.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 |
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, ""); |