This is currently copied from http://quickgit.kde.org/index.php?p=scratch%2Fdakon%2Fcmake-cxx11.git but there is a chance that in future it will be merged into CMake proper.
		
			
				
	
	
		
			20 lines
		
	
	
		
			252 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			252 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| 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;
 | |
| }
 |