cmake/c++11-test-constexpr-N2235.cpp

changeset 473
2a84149fe642
equal deleted inserted replaced
472:8986414c6ad5 473:2a84149fe642
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 }

mercurial