File: constexpr-N2235.cpp

package info (click to toggle)
emoslib 2%3A4.4.5-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 359,232 kB
  • ctags: 13,125
  • sloc: fortran: 93,166; ansic: 27,958; sh: 7,500; f90: 5,209; perl: 604; cpp: 305; makefile: 78; python: 53
file content (19 lines) | stat: -rw-r--r-- 252 bytes parent folder | download | duplicates (32)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
constexpr int square(int x)
{
	return x*x;
}

constexpr int the_answer()
{
	return 42;
}

int main()
{
	int test_arr[square(3)];
	bool ret = (
		(square(the_answer()) == 1764) &&
		(sizeof(test_arr)/sizeof(test_arr[0]) == 9)
	);
	return ret ? 0 : 1;
}