Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp1z/constexpr-if25.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 // PR c++/86740 |
2 // { dg-do compile { target c++17 } } | |
3 | |
4 struct Constant | |
5 { | |
6 static constexpr int value = 0; | |
7 }; | |
8 template<typename F> | |
9 void invokeWithConstant(F &&f) | |
10 { | |
11 f(Constant{}); | |
12 } | |
13 int foo() | |
14 { | |
15 int count = 0; | |
16 invokeWithConstant | |
17 ([&] (auto id1) | |
18 { | |
19 invokeWithConstant | |
20 ([&] (auto id2) | |
21 { | |
22 if constexpr (id1.value == 0 && id2.value == 0) | |
23 [&] { count = 1; } (); | |
24 }); | |
25 }); | |
26 return count; | |
27 } |