Make x.0.10 publicly available
[ACE_TAO.git] / ACE / tests / Compiler_Features_32_Test.cpp
blobcbba2e2cfe89e493bae7d017ff67a305309f05ff
1 /**
2 * This program checks if the compiler doesn't have a certain bug
3 * that we encountered when testing C++11 features.
5 * This test validates whether a alias can be used to explicitly
6 * call a destructor, which is related to DR244 (see
7 * http://wg21.cmeerw.net/cwg/issue244)
9 * This is partly fixed May 2014 in clang, see
10 * http://llvm.org/viewvc/llvm-project?view=revision&revision=209319
12 * Currently the using is required, see
13 * https://bugs.llvm.org/show_bug.cgi?id=12350
16 #include "test_config.h"
18 #include <string>
20 class A
22 public:
23 A () = default;
24 void clear ();
25 private:
26 union u_type_
28 u_type_ ();
29 ~u_type_ ();
30 std::string string_member_;
31 bool bool_member_;
32 } u_;
35 A::u_type_::u_type_ ()
39 A::u_type_::~u_type_ ()
43 void A::clear ()
45 #if defined __clang__ && \
46 (defined __apple_build_version__ && __apple_build_version__ <= 12000322 \
47 || __clang_major__ <= 10)
48 #define CLANG_WORKAROUND
49 #endif
51 #ifdef CLANG_WORKAROUND
52 // clang requires one of two workarounds:
53 // 1. the name after ~ must be in scope
54 using std::string;
55 #endif
56 this->u_.string_member_.std::string::~string ();
59 struct B {
60 struct u_type_ {
61 std::string m;
62 } u_;
63 void clear() {
64 #ifdef CLANG_WORKAROUND
65 // 2. actual class name instead of typedef
66 u_.m.std::string::~basic_string ();
67 #else
68 u_.m.std::string::~string ();
69 #endif
73 int
74 run_main (int, ACE_TCHAR *[])
76 ACE_START_TEST (ACE_TEXT("Compiler_Features_32_Test"));
78 A a_v;
80 ACE_DEBUG ((LM_INFO,
81 ACE_TEXT ("C++11 support ok\n")));
83 ACE_END_TEST;
85 return 0;