4 * This program checks if the compiler / platform supports the
5 * std::auto_ptr<> correctly. The motivation for this test was a discussion
6 * on the development mailing list, and the documentation was captured
9 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715
12 #include "test_config.h"
14 // The first part of the test is to compile this line. If the program
15 // does not compile the platform is just too broken.
18 // For extra challenge, we use the anonymous namespace
40 static int constructors
;
41 static int destructors
;
44 int Base::constructors
= 0;
45 int Base::destructors
= 0;
47 class Derived
: public Base
57 run_main (int, ACE_TCHAR
*[])
59 ACE_START_TEST (ACE_TEXT("Compiler_Features_09_Test"));
61 // As usual, the exit status from the test is 0 on success, 1 on
65 // ... this works with the ACE version of auto_ptr (well, the
66 // namespace is broken, but you get the idea) ...
67 std::auto_ptr
<Base
> x(new Base
);
68 std::auto_ptr
<Derived
> y(new Derived
);
70 // ... with a compliant implementation of std::auto_ptr<> you should be
73 // but the Solaris compiler was broken as of August, 2009!! So you have
74 // to work around in the following way. This compiler is important
75 // enough for the ACE community, so we have to support this broken
79 // ... there should be just one destruction so far ...
80 if (Base::destructors
!= 1)
84 ACE_TEXT("Destructor count off, expected 1, found %d\n"),
88 std::auto_ptr
<Base
> z
;
90 if (Base::destructors
!= 1)
94 ACE_TEXT("Destructor count off, expected 1, found %d\n"),
101 ACE_TEXT("x contents should have been transferred\n")