31#if defined (__IBMCPP__) && !defined (_RWSTD_NO_IMPLICIT_INCLUSION)
34# define _RWSTD_NO_IMPLICIT_INCLUSION
41#ifndef _RWSTD_EXPLICIT_INSTANTIATION
45# if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD)
49# define TEST_CLASS_DEF(name, Tparam) \
50 template class std::name Tparam \
57# define TEST_CLASS_DEF(name, Tparam) \
58 template class std::name Tparam; \
67# if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_HONOR_STD)
71# define TEST_CLASS_DEF(name, ignore) void name (void *name)
75# define TEST_CLASS_DEF(name, ignore) void foo (void *name)
109 static void sink (std::auto_ptr<Base>) { }
117 static std::auto_ptr<Derived>
source () {
118 return std::auto_ptr<Derived> ();
121 static void sink (std::auto_ptr<Derived>) { }
132#ifndef _RWSTD_NO_NATIVE_BOOL
151 rw_info (0, 0, 0,
"std::auto_ptr<%s>", tname);
154 rw_note (0, 0, __LINE__,
"auto_ptr<%s> test disabled", tname);
160 typedef typename std::auto_ptr<T>::element_type element_type;
163 element_type *elem = (
T*)0;
171#define FUN(result, T, name, arg_list) do { \
172 result (std::auto_ptr<T>::*pf) arg_list = &std::auto_ptr<T>::name; \
173 _RWSTD_UNUSED (pf); \
176#if !defined (__HP_aCC) || _RWSTD_HP_aCC_MAJOR > 5
179 FUN (std::auto_ptr<T>&,
T,
operator=, (std::auto_ptr<T>&)
_PTR_THROWS(()));
185#ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN
196#if !defined(__GNUG__) || __GNUG__ > 3 || __GNUG__ == 3 && __GNUC_MINOR__ > 2
200# if !defined (__HP_aCC) || _RWSTD_HP_aCC_MAJOR > 5
203 FUN (std::auto_ptr<Base>&,
Base,
204 operator=, (std::auto_ptr<Derived>&)
_PTR_THROWS (()));
208# if !defined (__SUNPRO_CC) || __SUNPRO_CC > 0x540
210# if !defined (_RWSTD_MSVC) || _RWSTD_MSVC > 1310
212 operator std::auto_ptr_ref<Base>, ()
_PTR_THROWS (()));
215 operator std::auto_ptr<Base>, ()
_PTR_THROWS (()));
225 rw_info (0, 0, 0,
"[lib.auto.ptr.cons]");
230 std::auto_ptr<T> ap1 (pt);
231 rw_assert (pt == ap1.get (), 0, __LINE__,
232 "auto_ptr<%s>::auto_ptr (%1$s*)", tname);
235 std::auto_ptr<T> ap2 (ap1);
237 "auto_ptr<%s>::auto_ptr (auto_ptr&", tname);
238 rw_assert (pt == ap2.get (), 0, __LINE__,
239 "auto_ptr<%s>::auto_ptr (auto_ptr&)", tname);
244 "auto_ptr<%s>::operator= (auto_ptr&)", tname);
245 rw_assert (pt == ap1.get (), 0, __LINE__,
246 "auto_ptr<%s>::operator= (auto_ptr&)", tname);
249 rw_info (0, 0, 0,
"[lib.auto.ptr.members]");
252 rw_assert (*ap1.get () == ap1.operator*(), 0, __LINE__,
253 "auto_ptr<%s>::operator*()", tname);
256 rw_assert (ap1.get () == ap1.operator->(), 0, __LINE__,
257 "auto_ptr<%s>::operator->()", tname);
260 rw_assert (pt == ap1.get (), 0, __LINE__,
261 "auto_ptr<%s>::get ()", tname);
264 rw_assert (pt == ap1.release () && 0 == ap1.get (), 0, __LINE__,
265 "auto_ptr<%s>::release ()", tname);
270 rw_assert (pt == ap1.get (), 0, __LINE__,
271 "auto_ptr<%s>::reset ()", tname);
282 rw_info (0, 0, 0,
"std::auto_ptr<void> [extension]");
284 std::auto_ptr<void> ap1;
285 std::auto_ptr<void> ap2 ((
void*)0);
286 std::auto_ptr<void> ap3 (ap2);
291#if !defined (__HP_aCC) || 6 <= _RWSTD_HP_aCC_MAJOR
295 ap1.operator=<
void>(ap1);
299 std::auto_ptr<int> ap4;
302 ap1.operator=<
int>(ap4);
308 pv = ap1.operator->();
315#if !defined (__HP_aCC) || 6 <= _RWSTD_HP_aCC_MAJOR
319 const std::auto_ptr_ref<void> ar = ap1.operator std::auto_ptr_ref<void>();
320 const std::auto_ptr<void> ap5 = ap1.operator std::auto_ptr<void>();
331static std::auto_ptr<Derived>
332test_auto_ptr_conversions ()
334 rw_info (0, 0, 0,
"[lib.auto.ptr.conv]");
338 std::auto_ptr<Derived> ap1 (
pd);
340 "auto_ptr::auto_ptr ()");
342 std::auto_ptr<Base> ap2 (ap1);
345 "auto_ptr<Base>::auto_ptr(auto_ptr<Derived>&)");
347 "auto_ptr<Base>::auto_ptr(auto_ptr<Derived>&)");
353 rw_assert (
pd == ap2.get (), 0, __LINE__,
"auto_ptr::reset ()");
357 rw_assert (
pd == ap2.get (), 0, __LINE__,
"auto_ptr::reset ()");
361 std::auto_ptr<Base> ap3 =
362 std::auto_ptr<Base>(std::auto_ptr<Derived>(
pd));
365 "auto_ptr<>::auto_ptr(std::auto_ptr_ref)");
367#if !defined (__HP_aCC) || _RWSTD_HP_aCC_MAJOR > 5
370 std::auto_ptr<Derived> ap4 (
pd);
371 ap3 = std::auto_ptr<Base> (ap4);
374 "auto_ptr<>::operator auto_ptr<>()");
383 std::auto_ptr<Derived> pd2 (pd1);
385#if !defined (__HP_aCC) || _RWSTD_HP_aCC_MAJOR > 5
394 std::auto_ptr<Base> pb2 (pd1);
415static int rw_opt_no_conversions;
422#ifndef _RWSTD_NO_NATIVE_BOOL
436 if (rw_opt_no_conversions)
437 rw_note (0, 0, 0,
"conversions test disabled");
439 test_auto_ptr_conversions ();
446 rw_note (0, 0, 0,
"auto_ptr<void> test disabled");
448 test_auto_ptr_void ();
455int main (
int argc,
char *argv[])
457 return rw_test (argc, argv, __FILE__,
462 &rw_opt_no_conversions,
void count(T, T, const U &,...)
#define _PTR_THROWS(spec)
void test_auto_ptr(T *, const char *tname)
#define TEST_CLASS_DEF(name, Tparam)
#define FUN(result, T, name, arg_list)
void is_explicit(const std::auto_ptr< Base > &)
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
#define _RWSTD_UNUSED(arg)
#define _RWSTD_STATIC_CAST(T, x)
_TEST_EXPORT int rw_enabled(const char *name)
_TEST_EXPORT int rw_test(int argc, char *argv[], const char *filename, const char *clause, const char *comment, int(*testfun)(int, char **), const char *optspec,...)
_TEST_EXPORT int rw_info(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_note(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_assert(int, const char *, int, const char *,...)
static void sink(std::auto_ptr< Base >)
static void sink(std::auto_ptr< Derived >)
static std::auto_ptr< Derived > source()
has_implicit_ctor(Base *)
has_implicit_ctor(void **)
has_implicit_ctor(double *)
has_implicit_ctor(char *)
has_implicit_ctor(bool *)