Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / tests / Compiler_Features_40_Test.cpp
blob00cf8183fb6f1c3cd58bedee3702b4a8caafe543
1 /**
2 * This program checks if the compiler/RTL does have correct support
3 * for stack unwinding
4 */
6 #include "test_config.h"
7 #include <vector>
8 #include <string>
9 #include <stdexcept>
11 class TTestClass;
13 static TTestClass* this_pointer {};
14 static bool isDataCorrupt = false;
16 class TTestClass
18 unsigned char data[256];
20 public:
21 TTestClass()
23 this_pointer = this;
25 // Generate a sequence of numbers (0 - 255)
26 for (int i = 0; i < 256; i++)
28 data[i] = i;
32 ~TTestClass()
34 if (this != this_pointer)
36 isDataCorrupt = true;
37 ACE_ERROR ((LM_ERROR, "ERROR: Invalid this %@ != %@\n", this, this_pointer));
40 // Check if number sequence is still the same
41 for (int i = 0; i < 256; i++)
43 if (data[i] != i)
45 isDataCorrupt = true;
46 break;
51 private:
52 std::vector<std::string> SomeData;
55 void SomeFunction(std::string)
57 // Unused function
60 void Test()
62 std::string str = "branch_b";
64 if (str == "branch_a")
66 SomeFunction("");
68 else if (str == "branch_b")
70 TTestClass test;
71 throw std::runtime_error("Some exception");
75 int
76 run_main (int, ACE_TCHAR *[])
78 ACE_START_TEST (ACE_TEXT("Compiler_Features_40_Test"));
80 int retval = 0;
81 try
83 Test();
85 catch (...)
89 if (isDataCorrupt)
91 ACE_ERROR((LM_ERROR, "ERROR: Invalid data\n"));
92 ++retval;
94 else
96 ACE_DEBUG ((LM_DEBUG, "Correct data\n"));
99 ACE_END_TEST;
101 return retval;