Compile fixes
[ACE_TAO.git] / ACE / tests / Compiler_Features_28_Test.cpp
bloba31da3380f4230be72059f82e04504eb79255af3
1 /**
2 * This program checks if the compiler doesn't have a certain bug
3 * that we encountered when testing C++11 features
4 */
6 #include "test_config.h"
8 #include <cstdint>
10 enum class OPERATIONS
12 ADD_OBJECT_POLICY,
13 ADD_CURRENT_POLICY,
14 LAST_OPERATION
17 /// Using this to iterate over the OPERATIONS enum
18 OPERATIONS operator++(OPERATIONS& x) { return x = static_cast<OPERATIONS>(static_cast<uint16_t>(x) + 1); }
19 OPERATIONS operator*(OPERATIONS c) {return c;}
20 OPERATIONS begin(OPERATIONS ) {return OPERATIONS::ADD_OBJECT_POLICY;}
21 OPERATIONS end(OPERATIONS ) {return OPERATIONS::LAST_OPERATION;}
23 int
24 run_main (int, ACE_TCHAR *[])
26 ACE_START_TEST (ACE_TEXT("Compiler_Features_28_Test"));
28 int16_t count = 0;
29 for (OPERATIONS op : OPERATIONS ())
31 if (op == OPERATIONS::ADD_OBJECT_POLICY && count != 0)
32 ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n"));
33 if (op == OPERATIONS::ADD_CURRENT_POLICY && count != 1)
34 ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n"));
35 if (op == OPERATIONS::LAST_OPERATION && count != 2)
36 ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n"));
37 ++count;
40 ACE_END_TEST;
42 return 0;