Commit 882b3d5c by Paolo Carlini

[multiple changes]

2010-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/41792
	* include/tr1_impl/array: Use std::__addressof.
	* include/std/functional (reference_wrapper): Likewise.
	* include/ext/throw_allocator.h: Likewise.
	* include/ext/pool_allocator.h: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/new_allocator.h: Likewise.
	* include/ext/malloc_allocator.h: Likewise.
	* include/ext/array_allocator.h: Likewise.
	* include/ext/mt_allocator.h: Likewise.
	* include/ext/extptr_allocator.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/stl_uninitialized.h: Likewise.
	* include/bits/list.tcc: Likewise.
	* include/bits/stl_construct.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* testsuite/20_util/reference_wrapper/41792.cc: New.
	* testsuite/23_containers/unordered_map/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/multimap/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/set/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/unordered_set/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/vector/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/deque/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/multiset/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/list/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/map/requirements/
	explicit_instantiation/4.cc: Likewise.
	* testsuite/23_containers/array/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/
	dr438/assign_neg.cc: Adjust dg-error line numbers.
	* testsuite/23_containers/forward_list/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	assign_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.

2010-05-20  Peter Dimov  <pdimov@pdimov.com>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/move.h (__addressof, addressof): Add.
	* testsuite/util/testsuite_api.h (struct OverloadedAddress): Add.
	* testsuite/20_util/addressof/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/addressof/1.cc: Likewise.

From-SVN: r159643
parent 9f946bc1
2010-05-20 Paolo Carlini <paolo.carlini@oracle.com> 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/41792
* include/tr1_impl/array: Use std::__addressof.
* include/std/functional (reference_wrapper): Likewise.
* include/ext/throw_allocator.h: Likewise.
* include/ext/pool_allocator.h: Likewise.
* include/ext/bitmap_allocator.h: Likewise.
* include/ext/new_allocator.h: Likewise.
* include/ext/malloc_allocator.h: Likewise.
* include/ext/array_allocator.h: Likewise.
* include/ext/mt_allocator.h: Likewise.
* include/ext/extptr_allocator.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/hashtable_policy.h: Likewise.
* include/bits/forward_list.h: Likewise.
* include/bits/stl_uninitialized.h: Likewise.
* include/bits/list.tcc: Likewise.
* include/bits/stl_construct.h: Likewise.
* include/bits/stl_tree.h: Likewise.
* testsuite/20_util/reference_wrapper/41792.cc: New.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/multimap/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/set/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/vector/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/deque/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/multiset/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/list/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/map/requirements/
explicit_instantiation/4.cc: Likewise.
* testsuite/23_containers/array/requirements/
explicit_instantiation/3.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/
dr438/assign_neg.cc: Adjust dg-error line numbers.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
assign_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2010-05-20 Peter Dimov <pdimov@pdimov.com>
Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/move.h (__addressof, addressof): Add.
* testsuite/util/testsuite_api.h (struct OverloadedAddress): Add.
* testsuite/20_util/addressof/requirements/
explicit_instantiation.cc: New.
* testsuite/20_util/addressof/1.cc: Likewise.
2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_pair.h (pair<>::pair(const pair&)): Defaulted * include/bits/stl_pair.h (pair<>::pair(const pair&)): Defaulted
in C++0x mode. in C++0x mode.
(pair<>::operator=(const pair<>&)): Add in C++0x mode. (pair<>::operator=(const pair<>&)): Add in C++0x mode.
......
...@@ -139,7 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -139,7 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer pointer
operator->() const operator->() const
{ return &static_cast<_Node*>(this->_M_node)->_M_value; } { return std::__addressof(static_cast<_Node*>
(this->_M_node)->_M_value); }
_Self& _Self&
operator++() operator++()
...@@ -210,7 +211,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -210,7 +211,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer pointer
operator->() const operator->() const
{ return &static_cast<_Node*>(this->_M_node)->_M_value; } { return std::__addressof(static_cast<_Node*>
(this->_M_node)->_M_value); }
_Self& _Self&
operator++() operator++()
......
...@@ -145,7 +145,7 @@ namespace __detail ...@@ -145,7 +145,7 @@ namespace __detail
pointer pointer
operator->() const operator->() const
{ return &this->_M_cur->_M_v; } { return std::__addressof(this->_M_cur->_M_v); }
_Node_iterator& _Node_iterator&
operator++() operator++()
...@@ -190,7 +190,7 @@ namespace __detail ...@@ -190,7 +190,7 @@ namespace __detail
pointer pointer
operator->() const operator->() const
{ return &this->_M_cur->_M_v; } { return std::__addressof(this->_M_cur->_M_v); }
_Node_const_iterator& _Node_const_iterator&
operator++() operator++()
...@@ -288,7 +288,7 @@ namespace __detail ...@@ -288,7 +288,7 @@ namespace __detail
pointer pointer
operator->() const operator->() const
{ return &this->_M_cur_node->_M_v; } { return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_iterator& _Hashtable_iterator&
operator++() operator++()
...@@ -338,7 +338,7 @@ namespace __detail ...@@ -338,7 +338,7 @@ namespace __detail
pointer pointer
operator->() const operator->() const
{ return &this->_M_cur_node->_M_v; } { return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_const_iterator& _Hashtable_const_iterator&
operator++() operator++()
......
...@@ -73,7 +73,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -73,7 +73,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
_M_get_Node_allocator().destroy(__tmp); _M_get_Node_allocator().destroy(__tmp);
#else #else
_M_get_Tp_allocator().destroy(&__tmp->_M_data); _M_get_Tp_allocator().destroy(std::__addressof(__tmp->_M_data));
#endif #endif
_M_put_node(__tmp); _M_put_node(__tmp);
} }
...@@ -198,7 +198,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -198,7 +198,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 526. Is it undefined if a function in the standard changes // 526. Is it undefined if a function in the standard changes
// in parameters? // in parameters?
if (&*__first != &__value) if (std::__addressof(*__first) != std::__addressof(__value))
_M_erase(__first); _M_erase(__first);
else else
__extra = __first; __extra = __first;
......
// Move, forward and identity for C++0x + swap -*- C++ -*- // Move, forward and identity for C++0x + swap -*- C++ -*-
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -34,6 +34,19 @@ ...@@ -34,6 +34,19 @@
#include <cstddef> #include <cstddef>
#include <bits/concept_check.h> #include <bits/concept_check.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
// Used, in C++03 mode too, by allocators, etc.
template<typename _Tp>
inline _Tp*
__addressof(_Tp& __r)
{
return reinterpret_cast<_Tp*>
(&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
}
_GLIBCXX_END_NAMESPACE
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <type_traits> // Brings in std::declval too. #include <type_traits> // Brings in std::declval too.
...@@ -83,6 +96,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -83,6 +96,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// declval, defined in <type_traits>. /// declval, defined in <type_traits>.
/**
* @brief Returns the actual address of the object or function
* referenced by r, even in the presence of an overloaded
* operator&.
* @param __r Reference to an object or function.
* @return The actual address.
*/
template<typename _Tp>
inline _Tp*
addressof(_Tp& __r)
{ return std::__addressof(__r); }
_GLIBCXX_END_NAMESPACE _GLIBCXX_END_NAMESPACE
#define _GLIBCXX_MOVE(_Tp) std::move(_Tp) #define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
......
// nonstandard construct and destroy functions -*- C++ -*- // nonstandard construct and destroy functions -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
// 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -96,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -96,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__destroy(_ForwardIterator __first, _ForwardIterator __last) __destroy(_ForwardIterator __first, _ForwardIterator __last)
{ {
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
std::_Destroy(&*__first); std::_Destroy(std::__addressof(*__first));
} }
}; };
...@@ -137,7 +138,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -137,7 +138,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Allocator& __alloc) _Allocator& __alloc)
{ {
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
__alloc.destroy(&*__first); __alloc.destroy(std::__addressof(*__first));
} }
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
......
...@@ -128,14 +128,14 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -128,14 +128,14 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_List_iterator(_List_node_base* __x) _List_iterator(_List_node_base* __x)
: _M_node(__x) { } : _M_node(__x) { }
// Must downcast from List_node_base to _List_node to get to _M_data. // Must downcast from _List_node_base to _List_node to get to _M_data.
reference reference
operator*() const operator*() const
{ return static_cast<_Node*>(_M_node)->_M_data; } { return static_cast<_Node*>(_M_node)->_M_data; }
pointer pointer
operator->() const operator->() const
{ return &static_cast<_Node*>(_M_node)->_M_data; } { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self& _Self&
operator++() operator++()
...@@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
pointer pointer
operator->() const operator->() const
{ return &static_cast<_Node*>(_M_node)->_M_data; } { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self& _Self&
operator++() operator++()
...@@ -461,7 +461,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -461,7 +461,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_Node* __p = this->_M_get_node(); _Node* __p = this->_M_get_node();
__try __try
{ {
_M_get_Tp_allocator().construct(&__p->_M_data, __x); _M_get_Tp_allocator().construct
(std::__addressof(__p->_M_data), __x);
} }
__catch(...) __catch(...)
{ {
...@@ -1453,7 +1454,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -1453,7 +1454,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
_M_get_Node_allocator().destroy(__n); _M_get_Node_allocator().destroy(__n);
#else #else
_M_get_Tp_allocator().destroy(&__n->_M_data); _M_get_Tp_allocator().destroy(std::__addressof(__n->_M_data));
#endif #endif
_M_put_node(__n); _M_put_node(__n);
} }
......
// RB tree implementation -*- C++ -*- // RB tree implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
// 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -176,7 +177,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -176,7 +177,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer pointer
operator->() const operator->() const
{ return &static_cast<_Link_type>(_M_node)->_M_value_field; } { return std::__addressof(static_cast<_Link_type>
(_M_node)->_M_value_field); }
_Self& _Self&
operator++() operator++()
...@@ -251,7 +253,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -251,7 +253,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer pointer
operator->() const operator->() const
{ return &static_cast<_Link_type>(_M_node)->_M_value_field; } { return std::__addressof(static_cast<_Link_type>
(_M_node)->_M_value_field); }
_Self& _Self&
operator++() operator++()
...@@ -368,7 +371,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -368,7 +371,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ {
_Link_type __tmp = _M_get_node(); _Link_type __tmp = _M_get_node();
__try __try
{ get_allocator().construct(&__tmp->_M_value_field, __x); } { get_allocator().construct
(std::__addressof(__tmp->_M_value_field), __x); }
__catch(...) __catch(...)
{ {
_M_put_node(__tmp); _M_put_node(__tmp);
...@@ -380,7 +384,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -380,7 +384,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void void
_M_destroy_node(_Link_type __p) _M_destroy_node(_Link_type __p)
{ {
get_allocator().destroy(&__p->_M_value_field); get_allocator().destroy(std::__addressof(__p->_M_value_field));
_M_put_node(__p); _M_put_node(__p);
} }
#else #else
......
// Raw memory manipulators -*- C++ -*- // Raw memory manipulators -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
// 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -71,7 +72,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -71,7 +72,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try __try
{ {
for (; __first != __last; ++__first, ++__cur) for (; __first != __last; ++__first, ++__cur)
std::_Construct(&*__cur, *__first); std::_Construct(std::__addressof(*__cur), *__first);
return __cur; return __cur;
} }
__catch(...) __catch(...)
...@@ -129,7 +130,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -129,7 +130,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try __try
{ {
for (; __cur != __last; ++__cur) for (; __cur != __last; ++__cur)
std::_Construct(&*__cur, __x); std::_Construct(std::__addressof(*__cur), __x);
} }
__catch(...) __catch(...)
{ {
...@@ -185,11 +186,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -185,11 +186,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_ForwardIterator __cur = __first; _ForwardIterator __cur = __first;
__try __try
{ {
std::_Construct(&*__first, _GLIBCXX_MOVE(__value)); std::_Construct(std::__addressof(*__first),
_GLIBCXX_MOVE(__value));
_ForwardIterator __prev = __cur; _ForwardIterator __prev = __cur;
++__cur; ++__cur;
for(; __cur != __last; ++__cur, ++__prev) for(; __cur != __last; ++__cur, ++__prev)
std::_Construct(&*__cur, _GLIBCXX_MOVE(*__prev)); std::_Construct(std::__addressof(*__cur),
_GLIBCXX_MOVE(*__prev));
__value = _GLIBCXX_MOVE(*__prev); __value = _GLIBCXX_MOVE(*__prev);
} }
__catch(...) __catch(...)
...@@ -245,7 +248,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -245,7 +248,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try __try
{ {
for (; __n > 0; --__n, ++__cur) for (; __n > 0; --__n, ++__cur)
std::_Construct(&*__cur, __x); std::_Construct(std::__addressof(*__cur), __x);
} }
__catch(...) __catch(...)
{ {
...@@ -301,7 +304,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -301,7 +304,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try __try
{ {
for (; __first != __last; ++__first, ++__cur) for (; __first != __last; ++__first, ++__cur)
__alloc.construct(&*__cur, *__first); __alloc.construct(std::__addressof(*__cur), *__first);
return __cur; return __cur;
} }
__catch(...) __catch(...)
...@@ -337,7 +340,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -337,7 +340,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try __try
{ {
for (; __cur != __last; ++__cur) for (; __cur != __last; ++__cur)
__alloc.construct(&*__cur, __x); __alloc.construct(std::__addressof(*__cur), __x);
} }
__catch(...) __catch(...)
{ {
...@@ -362,7 +365,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -362,7 +365,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try __try
{ {
for (; __n > 0; --__n, ++__cur) for (; __n > 0; --__n, ++__cur)
__alloc.construct(&*__cur, __x); __alloc.construct(std::__addressof(*__cur), __x);
} }
__catch(...) __catch(...)
{ {
...@@ -498,7 +501,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -498,7 +501,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try __try
{ {
for (; __n > 0; --__n, ++__first, ++__cur) for (; __n > 0; --__n, ++__first, ++__cur)
::new(static_cast<void*>(&*__cur)) typename ::new(static_cast<void*>(std::__addressof(*__cur))) typename
iterator_traits<_ForwardIterator>::value_type(*__first); iterator_traits<_ForwardIterator>::value_type(*__first);
return __cur; return __cur;
} }
......
// array allocator -*- C++ -*- // array allocator -*- C++ -*-
// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 // Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -55,10 +55,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -55,10 +55,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef _Tp value_type; typedef _Tp value_type;
pointer pointer
address(reference __x) const { return &__x; } address(reference __x) const { return std::__addressof(__x); }
const_pointer const_pointer
address(const_reference __x) const { return &__x; } address(const_reference __x) const { return std::__addressof(__x); }
void void
deallocate(pointer, size_type) deallocate(pointer, size_type)
......
// Bitmap Allocator. -*- C++ -*- // Bitmap Allocator. -*- C++ -*-
// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 // Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -1039,11 +1039,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -1039,11 +1039,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer pointer
address(reference __r) const address(reference __r) const
{ return &__r; } { return std::__addressof(__r); }
const_pointer const_pointer
address(const_reference __r) const address(const_reference __r) const
{ return &__r; } { return std::__addressof(__r); }
size_type size_type
max_size() const throw() max_size() const throw()
......
// <extptr_allocator.h> -*- C++ -*- // <extptr_allocator.h> -*- C++ -*-
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -82,10 +82,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -82,10 +82,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ } { }
pointer address(reference __x) const pointer address(reference __x) const
{ return &__x; } { return std::__addressof(__x); }
const_pointer address(const_reference __x) const const_pointer address(const_reference __x) const
{ return &__x; } { return std::__addressof(__x); }
pointer allocate(size_type __n, void* __hint = 0) pointer allocate(size_type __n, void* __hint = 0)
{ return _M_real_alloc.allocate(__n,__hint); } { return _M_real_alloc.allocate(__n,__hint); }
......
// Allocator that wraps "C" malloc -*- C++ -*- // Allocator that wraps "C" malloc -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -74,10 +74,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -74,10 +74,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
~malloc_allocator() throw() { } ~malloc_allocator() throw() { }
pointer pointer
address(reference __x) const { return &__x; } address(reference __x) const { return std::__addressof(__x); }
const_pointer const_pointer
address(const_reference __x) const { return &__x; } address(const_reference __x) const { return std::__addressof(__x); }
// NB: __n is permitted to be 0. The C++ standard says nothing // NB: __n is permitted to be 0. The C++ standard says nothing
// about what the return value is when __n == 0. // about what the return value is when __n == 0.
......
...@@ -576,11 +576,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -576,11 +576,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer pointer
address(reference __x) const address(reference __x) const
{ return &__x; } { return std::__addressof(__x); }
const_pointer const_pointer
address(const_reference __x) const address(const_reference __x) const
{ return &__x; } { return std::__addressof(__x); }
size_type size_type
max_size() const throw() max_size() const throw()
......
// Allocator that wraps operator new -*- C++ -*- // Allocator that wraps operator new -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -73,10 +73,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -73,10 +73,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
~new_allocator() throw() { } ~new_allocator() throw() { }
pointer pointer
address(reference __x) const { return &__x; } address(reference __x) const { return std::__addressof(__x); }
const_pointer const_pointer
address(const_reference __x) const { return &__x; } address(const_reference __x) const { return std::__addressof(__x); }
// NB: __n is permitted to be 0. The C++ standard says nothing // NB: __n is permitted to be 0. The C++ standard says nothing
// about what the return value is when __n == 0. // about what the return value is when __n == 0.
......
// Allocators -*- C++ -*- // Allocators -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -147,10 +147,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -147,10 +147,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
~__pool_alloc() throw() { } ~__pool_alloc() throw() { }
pointer pointer
address(reference __x) const { return &__x; } address(reference __x) const { return std::__addressof(__x); }
const_pointer const_pointer
address(const_reference __x) const { return &__x; } address(const_reference __x) const { return std::__addressof(__x); }
size_type size_type
max_size() const throw() max_size() const throw()
......
...@@ -620,6 +620,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -620,6 +620,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ return _M_allocator.max_size(); } { return _M_allocator.max_size(); }
pointer pointer
address(reference __x) const { return std::__addressof(__x); }
const_pointer
address(const_reference __x) const { return std::__addressof(__x); }
pointer
allocate(size_type __n, std::allocator<void>::const_pointer hint = 0) allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
{ {
if (__n > this->max_size()) if (__n > this->max_size())
......
...@@ -390,7 +390,8 @@ namespace std ...@@ -390,7 +390,8 @@ namespace std
public: public:
typedef _Tp type; typedef _Tp type;
reference_wrapper(_Tp& __indata): _M_data(&__indata) reference_wrapper(_Tp& __indata)
: _M_data(std::__addressof(__indata))
{ } { }
reference_wrapper(_Tp&&) = delete; reference_wrapper(_Tp&&) = delete;
......
...@@ -83,19 +83,19 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 ...@@ -83,19 +83,19 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
// Iterators. // Iterators.
iterator iterator
begin() begin()
{ return iterator(&_M_instance[0]); } { return iterator(std::__addressof(_M_instance[0])); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(&_M_instance[0]); } { return const_iterator(std::__addressof(_M_instance[0])); }
iterator iterator
end() end()
{ return iterator(&_M_instance[_Nm]); } { return iterator(std::__addressof(_M_instance[_Nm])); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(&_M_instance[_Nm]); } { return const_iterator(std::__addressof(_M_instance[_Nm])); }
reverse_iterator reverse_iterator
rbegin() rbegin()
...@@ -116,11 +116,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 ...@@ -116,11 +116,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
const_iterator const_iterator
cbegin() const cbegin() const
{ return const_iterator(&_M_instance[0]); } { return const_iterator(std::__addressof(_M_instance[0])); }
const_iterator const_iterator
cend() const cend() const
{ return const_iterator(&_M_instance[_Nm]); } { return const_iterator(std::__addressof(_M_instance[_Nm])); }
const_reverse_iterator const_reverse_iterator
crbegin() const crbegin() const
...@@ -182,13 +182,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 ...@@ -182,13 +182,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
back() const back() const
{ return _Nm ? *(end() - 1) : *end(); } { return _Nm ? *(end() - 1) : *end(); }
_Tp* _Tp*
data() data()
{ return &_M_instance[0]; } { return std::__addressof(_M_instance[0]); }
const _Tp* const _Tp*
data() const data() const
{ return &_M_instance[0]; } { return std::__addressof(_M_instance[0]); }
}; };
// Array comparisons. // Array comparisons.
......
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <memory>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
void f1(int) { }
void test01()
{
bool test __attribute__((unused)) = true;
using namespace __gnu_test;
OverloadedAddress* ao1 = new OverloadedAddress();
OverloadedAddress& o1 = *ao1;
VERIFY( std::addressof(o1) == ao1 );
const OverloadedAddress* ao2 = new OverloadedAddress();
const OverloadedAddress& o2 = *ao2;
VERIFY( std::addressof(o2) == ao2 );
VERIFY( std::addressof(f1) == &f1 );
}
int main()
{
test01();
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// NB: This file is for testing utility with NO OTHER INCLUDES.
#include <memory>
namespace std
{
typedef short test_type;
template short* addressof(short&);
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <functional>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// libstdc++/41792
void test01()
{
using namespace __gnu_test;
OverloadedAddress* ao1 = new OverloadedAddress();
std::reference_wrapper<OverloadedAddress> rw1(*ao1);
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <array>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// libstdc++/41792
template class std::array<__gnu_test::OverloadedAddress, 3>;
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <deque>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::deque<__gnu_test::OverloadedAddress>;
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1194 } // { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1194 } // { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1194 } // { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1194 } // { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// { dg-options "-std=gnu++0x" }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <forward_list>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::forward_list<__gnu_test::OverloadedAddress>;
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1410 } // { dg-error "no matching" "" { target *-*-* } 1411 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1379 } // { dg-error "no matching" "" { target *-*-* } 1380 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1379 } // { dg-error "no matching" "" { target *-*-* } 1380 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1379 } // { dg-error "no matching" "" { target *-*-* } 1380 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
// Copyright (C) 2010 Free Software Foundation, Inc.
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <list>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::list<__gnu_test::OverloadedAddress>;
// Copyright (C) 2010 Free Software Foundation, Inc.
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <map>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::map<__gnu_test::OverloadedAddress,
__gnu_test::OverloadedAddress>;
// Copyright (C) 2010 Free Software Foundation, Inc.
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <map>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::multimap<__gnu_test::OverloadedAddress,
__gnu_test::OverloadedAddress>;
// Copyright (C) 2010 Free Software Foundation, Inc.
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <set>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::multiset<__gnu_test::OverloadedAddress>;
// Copyright (C) 2010 Free Software Foundation, Inc.
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <set>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::set<__gnu_test::OverloadedAddress>;
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <unordered_map>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
typedef __gnu_test::OverloadedAddress inst_type;
typedef __gnu_test::OverloadedAddress_hash hash_type;
// libstdc++/41792
template class std::unordered_map<inst_type, inst_type, hash_type>;
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <unordered_map>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
typedef __gnu_test::OverloadedAddress inst_type;
typedef __gnu_test::OverloadedAddress_hash hash_type;
// libstdc++/41792
template class std::unordered_multimap<inst_type, inst_type, hash_type>;
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <unordered_set>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
typedef __gnu_test::OverloadedAddress inst_type;
typedef __gnu_test::OverloadedAddress_hash hash_type;
// libstdc++/41792
template class std::unordered_multiset<inst_type, hash_type>;
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <unordered_set>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
typedef __gnu_test::OverloadedAddress inst_type;
typedef __gnu_test::OverloadedAddress_hash hash_type;
// libstdc++/41792
template class std::unordered_set<inst_type, hash_type>;
// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of library containers
#include <vector>
#include <testsuite_hooks.h>
#include <testsuite_api.h>
// { dg-do compile }
// libstdc++/41792
template class std::vector<__gnu_test::OverloadedAddress>;
// -*- C++ -*- // -*- C++ -*-
// Exception testing utils for the C++ library testsuite. // Exception testing utils for the C++ library testsuite.
// //
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -150,6 +150,30 @@ namespace __gnu_test ...@@ -150,6 +150,30 @@ namespace __gnu_test
operator()() const operator()() const
{ return result_type(2); } { return result_type(2); }
}; };
// For std::addressof, etc.
struct OverloadedAddressAux { };
struct OverloadedAddress
{
OverloadedAddressAux
operator&() const { return OverloadedAddressAux(); }
};
inline bool
operator<(const OverloadedAddress&, const OverloadedAddress&)
{ return false; }
inline bool
operator==(const OverloadedAddress&, const OverloadedAddress&)
{ return false; }
struct OverloadedAddress_hash
{
size_t
operator()(const OverloadedAddress&) const
{ return 1; }
};
} }
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment