2 #include "tao/LocalObject.h"
3 #include "tao/Version.h"
5 #if TAO_MAJOR_VERSION < 2 && TAO_MINOR_VERSION < 6
6 # define RV refcount_.value
8 # define RV _refcount_value
11 #define ASSERT_REFCOUNT(count, message) \
12 if (ximpl->RV () != count) \
14 ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("%l %C: expected %d actual %d\n"), \
15 message, count, ximpl->RV ()), -1); \
21 # if TAO_MAJOR_VERSION < 2 && TAO_MINOR_VERSION < 6
22 // FUZZ: disable check_for_TAO_Local_RefCounted_Object
23 , TAO_Local_RefCounted_Object
29 #if defined LOCAL && (TAO_MAJOR_VERSION < 2 && TAO_MINOR_VERSION < 6)
30 unsigned long _refcount_value () const { return refcount_
.value (); }
36 int ACE_TMAIN (int, ACE_TCHAR
*[])
39 XImpl
* ximpl
= new XImpl
;
43 CORBA::ORB_var orb
= CORBA::ORB_init (zero_args
,
44 static_cast<ACE_TCHAR
**> (0));
45 CORBA::Object_var obj
= orb
->resolve_initial_references ("RootPOA");
46 PortableServer::POA_var poa
= PortableServer::POA::_narrow (obj
);
47 XImpl
* x_servant
= new XImpl
;
48 PortableServer::ServantBase_var
sbv (x_servant
);
49 X_var x
= x_servant
->_this ();
53 ASSERT_REFCOUNT (1, "baseline");
58 ASSERT_REFCOUNT (2, "in struct");
60 ASSERT_REFCOUNT (3, "from struct");
63 ASSERT_REFCOUNT (1, "baseline reestablished");
69 ASSERT_REFCOUNT (2, "in sequence");
71 // For now, only attempt to compile this on MSVC -- it doesn't compile
72 // on GCC (and possibly others) due to:
73 // error: conversion from 'TAO::details::object_reference_sequence_element<TAO::details::object_reference_traits<X, TAO_Objref_Var_T<X>, true> >' to non-scalar type 'X_var' requested
74 // When the bug is fixed, the #ifdef should be removed. Until then, the
75 // test will appear to pass on other compilers, but the MSVC failures should
76 // be enough to notice that the bug needs fixing.
78 if (ximpl
->RV () < 3) x2
._retn (); // avoid a crash
79 ASSERT_REFCOUNT (3, "from sequence");