summaryrefslogtreecommitdiff
path: root/ACE/tests/Compiler_Features_37_Test.cpp
blob: 5d88aee0033c69dab8262f9250b0e54e9f3307ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
 * This program checks if the compiler doesn't have a certain bug
 * that we encountered when testing with ACE
 */

#include "test_config.h"
#include <utility>

template <typename key, typename value>
class my_map
{
public:
  my_map () : capacity_ (0), nodes_(0) {}
  ~my_map ();
  typedef key key_type;
  typedef value data_type;
  typedef std::pair<key, value> value_type;
  size_t capacity_;
  value_type* nodes_;
};

template <typename key, typename value>
my_map<key, value>::~my_map ()
{
 for (size_t i = 0; i != capacity_; ++i)
 {
#if defined (ACE_HAS_BCC32)
   using std::pair;
   (nodes_ + i)->~pair<key, value>();
#else
   (nodes_ + i)->~value_type ();
#endif
 }
}

class Bar
{
public:
 Bar () {}
 ~Bar () {}
};

int
run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT("Compiler_Features_37_Test"));

  my_map <size_t, Bar*> foo;
  ACE_UNUSED_ARG(foo);

  ACE_DEBUG ((LM_INFO,
              ACE_TEXT ("C++ support ok\n")));

  ACE_END_TEST;

  return 0;
}