Mercurial > thymian
comparison 3rdparty/vmime/cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-constexpr.cpp @ 0:a4671277546c tip
created the repository for the thymian project
| author | ferencd |
|---|---|
| date | Tue, 17 Aug 2021 11:19:54 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:a4671277546c |
|---|---|
| 1 constexpr int square(int x) | |
| 2 { | |
| 3 return x*x; | |
| 4 } | |
| 5 | |
| 6 constexpr int the_answer() | |
| 7 { | |
| 8 return 42; | |
| 9 } | |
| 10 | |
| 11 int main() | |
| 12 { | |
| 13 int test_arr[square(3)]; | |
| 14 bool ret = ( | |
| 15 (square(the_answer()) == 1764) && | |
| 16 (sizeof(test_arr)/sizeof(test_arr[0]) == 9) | |
| 17 ); | |
| 18 return ret ? 0 : 1; | |
| 19 } |
