Compile fixes
[ACE_TAO.git] / ACE / tests / Bug_3673_Regression_Test.cpp
blob413e6b3e64d1a15224b333b0cee535f0dbb6cc39
1 /**
2 * @file Bug_3673_Regression_Test.cpp
4 * Reproduces the problems reported in bug 3673
5 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3673
6 */
8 #include "test_config.h"
9 #include "ace/ACE.h"
10 #include "ace/OS_NS_stdio.h"
12 static bool construct_alpha = false;
13 static bool destruct_alpha = false;
14 static bool construct_beta = false;
15 static bool destruct_beta = false;
17 template <typename T>
18 struct Alpha
20 Alpha() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("construct alpha\n"))); construct_alpha = true;}
21 ~Alpha() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("destruct alpha\n"))); destruct_alpha = true;}
24 struct Beta
26 Beta() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("construct beta\n"))); construct_beta = true;}
27 ~Beta() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("destruct bepha\n"))); destruct_beta = true;}
30 struct Test
32 Alpha<int> a;
33 Beta b;
35 Test() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("throw oops\n"))); throw "oops"; }
38 int
39 run_main (int, ACE_TCHAR *[])
41 ACE_START_TEST (ACE_TEXT ("Bug_3673_Regression_Test"));
42 int result = 0;
44 bool caught_excep = false;
45 try
47 Test test;
49 catch (...)
51 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Caught exception!\n")));
52 caught_excep = true;
55 if (!caught_excep)
57 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not caught exception\n")));
58 ++result;
60 if (!construct_alpha)
62 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Constructor alpha not called\n")));
63 ++result;
65 if (!construct_beta)
67 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Constructor beta not called\n")));
68 ++result;
70 if (!destruct_alpha)
72 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Destructor alpha not called\n")));
73 ++result;
75 if (!destruct_beta)
77 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Destructor beta not called\n")));
78 ++result;
81 ACE_END_TEST;
83 return result;