aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2010-05-20 22:35:49 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-05-20 22:35:49 +0000
commit882b3d5c2e3be0b367f0eb9a9b94a99a1e22c60a (patch)
tree7b0162680322f924a64af3fdc20b66867b7de427
parent9f946bc11ce814f013c56503861a679c554363f2 (diff)
downloadgcc-882b3d5c2e3be0b367f0eb9a9b94a99a1e22c60a.zip
gcc-882b3d5c2e3be0b367f0eb9a9b94a99a1e22c60a.tar.gz
gcc-882b3d5c2e3be0b367f0eb9a9b94a99a1e22c60a.tar.bz2
[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
-rw-r--r--libstdc++-v3/ChangeLog73
-rw-r--r--libstdc++-v3/include/bits/forward_list.h6
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h8
-rw-r--r--libstdc++-v3/include/bits/list.tcc4
-rw-r--r--libstdc++-v3/include/bits/move.h27
-rw-r--r--libstdc++-v3/include/bits/stl_construct.h7
-rw-r--r--libstdc++-v3/include/bits/stl_list.h11
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h14
-rw-r--r--libstdc++-v3/include/bits/stl_uninitialized.h23
-rw-r--r--libstdc++-v3/include/ext/array_allocator.h6
-rw-r--r--libstdc++-v3/include/ext/bitmap_allocator.h6
-rw-r--r--libstdc++-v3/include/ext/extptr_allocator.h6
-rw-r--r--libstdc++-v3/include/ext/malloc_allocator.h6
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h4
-rw-r--r--libstdc++-v3/include/ext/new_allocator.h6
-rw-r--r--libstdc++-v3/include/ext/pool_allocator.h6
-rw-r--r--libstdc++-v3/include/ext/throw_allocator.h6
-rw-r--r--libstdc++-v3/include/std/functional3
-rw-r--r--libstdc++-v3/include/tr1_impl/array20
-rw-r--r--libstdc++-v3/testsuite/20_util/addressof/1.cc51
-rw-r--r--libstdc++-v3/testsuite/20_util/addressof/requirements/explicit_instantiation.cc31
-rw-r--r--libstdc++-v3/testsuite/20_util/reference_wrapper/41792.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/4.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/4.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/4.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/4.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/4.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/4.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc29
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_api.h26
44 files changed, 729 insertions, 73 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index be72417..fb99088 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,78 @@
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
in C++0x mode.
(pair<>::operator=(const pair<>&)): Add in C++0x mode.
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 57b7836..c0c135c 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -139,7 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer
operator->() const
- { return &static_cast<_Node*>(this->_M_node)->_M_value; }
+ { return std::__addressof(static_cast<_Node*>
+ (this->_M_node)->_M_value); }
_Self&
operator++()
@@ -210,7 +211,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer
operator->() const
- { return &static_cast<_Node*>(this->_M_node)->_M_value; }
+ { return std::__addressof(static_cast<_Node*>
+ (this->_M_node)->_M_value); }
_Self&
operator++()
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 6e6a8fb..694d0ff 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -145,7 +145,7 @@ namespace __detail
pointer
operator->() const
- { return &this->_M_cur->_M_v; }
+ { return std::__addressof(this->_M_cur->_M_v); }
_Node_iterator&
operator++()
@@ -190,7 +190,7 @@ namespace __detail
pointer
operator->() const
- { return &this->_M_cur->_M_v; }
+ { return std::__addressof(this->_M_cur->_M_v); }
_Node_const_iterator&
operator++()
@@ -288,7 +288,7 @@ namespace __detail
pointer
operator->() const
- { return &this->_M_cur_node->_M_v; }
+ { return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_iterator&
operator++()
@@ -338,7 +338,7 @@ namespace __detail
pointer
operator->() const
- { return &this->_M_cur_node->_M_v; }
+ { return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_const_iterator&
operator++()
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index 5359239..f1c4a10d 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -73,7 +73,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_M_get_Node_allocator().destroy(__tmp);
#else
- _M_get_Tp_allocator().destroy(&__tmp->_M_data);
+ _M_get_Tp_allocator().destroy(std::__addressof(__tmp->_M_data));
#endif
_M_put_node(__tmp);
}
@@ -198,7 +198,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 526. Is it undefined if a function in the standard changes
// in parameters?
- if (&*__first != &__value)
+ if (std::__addressof(*__first) != std::__addressof(__value))
_M_erase(__first);
else
__extra = __first;
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 9175481..a137f98 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -1,6 +1,6 @@
// 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
// software; you can redistribute it and/or modify it under the
@@ -34,6 +34,19 @@
#include <cstddef>
#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__
#include <type_traits> // Brings in std::declval too.
@@ -83,6 +96,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// 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
#define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
diff --git a/libstdc++-v3/include/bits/stl_construct.h b/libstdc++-v3/include/bits/stl_construct.h
index 3c30b9a..06a2902 100644
--- a/libstdc++-v3/include/bits/stl_construct.h
+++ b/libstdc++-v3/include/bits/stl_construct.h
@@ -1,6 +1,7 @@
// 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.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -96,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__destroy(_ForwardIterator __first, _ForwardIterator __last)
{
for (; __first != __last; ++__first)
- std::_Destroy(&*__first);
+ std::_Destroy(std::__addressof(*__first));
}
};
@@ -137,7 +138,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Allocator& __alloc)
{
for (; __first != __last; ++__first)
- __alloc.destroy(&*__first);
+ __alloc.destroy(std::__addressof(*__first));
}
template<typename _ForwardIterator, typename _Tp>
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index 5fcbc4f..56357ed 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -128,14 +128,14 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_List_iterator(_List_node_base* __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
operator*() const
{ return static_cast<_Node*>(_M_node)->_M_data; }
pointer
operator->() const
- { return &static_cast<_Node*>(_M_node)->_M_data; }
+ { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self&
operator++()
@@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
pointer
operator->() const
- { return &static_cast<_Node*>(_M_node)->_M_data; }
+ { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self&
operator++()
@@ -461,7 +461,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_Node* __p = this->_M_get_node();
__try
{
- _M_get_Tp_allocator().construct(&__p->_M_data, __x);
+ _M_get_Tp_allocator().construct
+ (std::__addressof(__p->_M_data), __x);
}
__catch(...)
{
@@ -1453,7 +1454,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_M_get_Node_allocator().destroy(__n);
#else
- _M_get_Tp_allocator().destroy(&__n->_M_data);
+ _M_get_Tp_allocator().destroy(std::__addressof(__n->_M_data));
#endif
_M_put_node(__n);
}
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index d37dc57..58c63cf 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -1,6 +1,7 @@
// 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.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -176,7 +177,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer
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&
operator++()
@@ -251,7 +253,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
pointer
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&
operator++()
@@ -368,7 +371,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
_Link_type __tmp = _M_get_node();
__try
- { get_allocator().construct(&__tmp->_M_value_field, __x); }
+ { get_allocator().construct
+ (std::__addressof(__tmp->_M_value_field), __x); }
__catch(...)
{
_M_put_node(__tmp);
@@ -380,7 +384,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void
_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);
}
#else
diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h
index 4b6399d..b78f920 100644
--- a/libstdc++-v3/include/bits/stl_uninitialized.h
+++ b/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -1,6 +1,7 @@
// 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.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -71,7 +72,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
for (; __first != __last; ++__first, ++__cur)
- std::_Construct(&*__cur, *__first);
+ std::_Construct(std::__addressof(*__cur), *__first);
return __cur;
}
__catch(...)
@@ -129,7 +130,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
for (; __cur != __last; ++__cur)
- std::_Construct(&*__cur, __x);
+ std::_Construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
@@ -185,11 +186,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_ForwardIterator __cur = __first;
__try
{
- std::_Construct(&*__first, _GLIBCXX_MOVE(__value));
+ std::_Construct(std::__addressof(*__first),
+ _GLIBCXX_MOVE(__value));
_ForwardIterator __prev = __cur;
++__cur;
for(; __cur != __last; ++__cur, ++__prev)
- std::_Construct(&*__cur, _GLIBCXX_MOVE(*__prev));
+ std::_Construct(std::__addressof(*__cur),
+ _GLIBCXX_MOVE(*__prev));
__value = _GLIBCXX_MOVE(*__prev);
}
__catch(...)
@@ -245,7 +248,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
for (; __n > 0; --__n, ++__cur)
- std::_Construct(&*__cur, __x);
+ std::_Construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
@@ -301,7 +304,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
for (; __first != __last; ++__first, ++__cur)
- __alloc.construct(&*__cur, *__first);
+ __alloc.construct(std::__addressof(*__cur), *__first);
return __cur;
}
__catch(...)
@@ -337,7 +340,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
for (; __cur != __last; ++__cur)
- __alloc.construct(&*__cur, __x);
+ __alloc.construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
@@ -362,7 +365,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
for (; __n > 0; --__n, ++__cur)
- __alloc.construct(&*__cur, __x);
+ __alloc.construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
@@ -498,7 +501,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__try
{
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);
return __cur;
}
diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h
index f36f273..36f15fe 100644
--- a/libstdc++-v3/include/ext/array_allocator.h
+++ b/libstdc++-v3/include/ext/array_allocator.h
@@ -1,6 +1,6 @@
// array allocator -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -55,10 +55,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef _Tp value_type;
pointer
- address(reference __x) const { return &__x; }
+ address(reference __x) const { return std::__addressof(__x); }
const_pointer
- address(const_reference __x) const { return &__x; }
+ address(const_reference __x) const { return std::__addressof(__x); }
void
deallocate(pointer, size_type)
diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h
index d91d9aa..05285f5 100644
--- a/libstdc++-v3/include/ext/bitmap_allocator.h
+++ b/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -1,6 +1,6 @@
// Bitmap Allocator. -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -1039,11 +1039,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer
address(reference __r) const
- { return &__r; }
+ { return std::__addressof(__r); }
const_pointer
address(const_reference __r) const
- { return &__r; }
+ { return std::__addressof(__r); }
size_type
max_size() const throw()
diff --git a/libstdc++-v3/include/ext/extptr_allocator.h b/libstdc++-v3/include/ext/extptr_allocator.h
index fab6b1d..d9e8cda 100644
--- a/libstdc++-v3/include/ext/extptr_allocator.h
+++ b/libstdc++-v3/include/ext/extptr_allocator.h
@@ -1,6 +1,6 @@
// <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
// software; you can redistribute it and/or modify it under the
@@ -82,10 +82,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ }
pointer address(reference __x) const
- { return &__x; }
+ { return std::__addressof(__x); }
const_pointer address(const_reference __x) const
- { return &__x; }
+ { return std::__addressof(__x); }
pointer allocate(size_type __n, void* __hint = 0)
{ return _M_real_alloc.allocate(__n,__hint); }
diff --git a/libstdc++-v3/include/ext/malloc_allocator.h b/libstdc++-v3/include/ext/malloc_allocator.h
index b432c63..ed3c3b2 100644
--- a/libstdc++-v3/include/ext/malloc_allocator.h
+++ b/libstdc++-v3/include/ext/malloc_allocator.h
@@ -1,6 +1,6 @@
// 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.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -74,10 +74,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
~malloc_allocator() throw() { }
pointer
- address(reference __x) const { return &__x; }
+ address(reference __x) const { return std::__addressof(__x); }
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
// about what the return value is when __n == 0.
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 0e67513..8fdb2f6 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -576,11 +576,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
pointer
address(reference __x) const
- { return &__x; }
+ { return std::__addressof(__x); }
const_pointer
address(const_reference __x) const
- { return &__x; }
+ { return std::__addressof(__x); }
size_type
max_size() const throw()
diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h
index 51666c3..beadddd 100644
--- a/libstdc++-v3/include/ext/new_allocator.h
+++ b/libstdc++-v3/include/ext/new_allocator.h
@@ -1,6 +1,6 @@
// 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.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -73,10 +73,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
~new_allocator() throw() { }
pointer
- address(reference __x) const { return &__x; }
+ address(reference __x) const { return std::__addressof(__x); }
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
// about what the return value is when __n == 0.
diff --git a/libstdc++-v3/include/ext/pool_allocator.h b/libstdc++-v3/include/ext/pool_allocator.h
index b1e6184..66cda84 100644
--- a/libstdc++-v3/include/ext/pool_allocator.h
+++ b/libstdc++-v3/include/ext/pool_allocator.h
@@ -1,6 +1,6 @@
// 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.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -147,10 +147,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
~__pool_alloc() throw() { }
pointer
- address(reference __x) const { return &__x; }
+ address(reference __x) const { return std::__addressof(__x); }
const_pointer
- address(const_reference __x) const { return &__x; }
+ address(const_reference __x) const { return std::__addressof(__x); }
size_type
max_size() const throw()
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index 48089bd..70b197a 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -620,6 +620,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ return _M_allocator.max_size(); }
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)
{
if (__n > this->max_size())
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 7de7edf..7f6d8b6 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -390,7 +390,8 @@ namespace std
public:
typedef _Tp type;
- reference_wrapper(_Tp& __indata): _M_data(&__indata)
+ reference_wrapper(_Tp& __indata)
+ : _M_data(std::__addressof(__indata))
{ }
reference_wrapper(_Tp&&) = delete;
diff --git a/libstdc++-v3/include/tr1_impl/array b/libstdc++-v3/include/tr1_impl/array
index edc4aec..db0364e 100644
--- a/libstdc++-v3/include/tr1_impl/array
+++ b/libstdc++-v3/include/tr1_impl/array
@@ -83,19 +83,19 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
// Iterators.
iterator
begin()
- { return iterator(&_M_instance[0]); }
+ { return iterator(std::__addressof(_M_instance[0])); }
const_iterator
begin() const
- { return const_iterator(&_M_instance[0]); }
+ { return const_iterator(std::__addressof(_M_instance[0])); }
iterator
end()
- { return iterator(&_M_instance[_Nm]); }
+ { return iterator(std::__addressof(_M_instance[_Nm])); }
const_iterator
end() const
- { return const_iterator(&_M_instance[_Nm]); }
+ { return const_iterator(std::__addressof(_M_instance[_Nm])); }
reverse_iterator
rbegin()
@@ -116,11 +116,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
const_iterator
cbegin() const
- { return const_iterator(&_M_instance[0]); }
+ { return const_iterator(std::__addressof(_M_instance[0])); }
const_iterator
cend() const
- { return const_iterator(&_M_instance[_Nm]); }
+ { return const_iterator(std::__addressof(_M_instance[_Nm])); }
const_reverse_iterator
crbegin() const
@@ -182,13 +182,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
back() const
{ return _Nm ? *(end() - 1) : *end(); }
- _Tp*
+ _Tp*
data()
- { return &_M_instance[0]; }
+ { return std::__addressof(_M_instance[0]); }
- const _Tp*
+ const _Tp*
data() const
- { return &_M_instance[0]; }
+ { return std::__addressof(_M_instance[0]); }
};
// Array comparisons.
diff --git a/libstdc++-v3/testsuite/20_util/addressof/1.cc b/libstdc++-v3/testsuite/20_util/addressof/1.cc
new file mode 100644
index 0000000..43009f3
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/addressof/1.cc
@@ -0,0 +1,51 @@
+// { 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;
+}
diff --git a/libstdc++-v3/testsuite/20_util/addressof/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/addressof/requirements/explicit_instantiation.cc
new file mode 100644
index 0000000..559cd20
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/addressof/requirements/explicit_instantiation.cc
@@ -0,0 +1,31 @@
+// { 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&);
+}
diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/41792.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/41792.cc
new file mode 100644
index 0000000..b167d71
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/41792.cc
@@ -0,0 +1,34 @@
+// { 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);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc
new file mode 100644
index 0000000..9bd5bc9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc
@@ -0,0 +1,30 @@
+// { 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..4685ae1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,30 @@
+// 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
index 8d72db5..1625e3b 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1194 }
+// { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
index 5f5ac2c..5acfcd1 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1194 }
+// { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
index 340a6be..dcf6908 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1194 }
+// { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
index 1173dc1..22574fd 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1194 }
+// { dg-error "no matching" "" { target *-*-* } 1196 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..11f1524
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,32 @@
+// { 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index d41e149..eb35a24 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1410 }
+// { dg-error "no matching" "" { target *-*-* } 1411 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index 01d9135..937404b 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -1,6 +1,6 @@
// 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
// software; you can redistribute it and/or modify it under the
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1379 }
+// { dg-error "no matching" "" { target *-*-* } 1380 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index c13f6565..74fc1b7 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1379 }
+// { dg-error "no matching" "" { target *-*-* } 1380 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index 262a7a1..3aebda5 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1379 }
+// { dg-error "no matching" "" { target *-*-* } 1380 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..7ad82a3
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,29 @@
+// 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..2a3700a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,30 @@
+// 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..82bd4cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,30 @@
+// 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..d55064c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,29 @@
+// 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..2bbe976
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,29 @@
+// 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..37b57b3
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,33 @@
+// { 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..d92fdc5
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,33 @@
+// { 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..6184026
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,33 @@
+// { 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..3f619b7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,33 @@
+// { 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>;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc
new file mode 100644
index 0000000..9305e3c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,29 @@
+// 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>;
diff --git a/libstdc++-v3/testsuite/util/testsuite_api.h b/libstdc++-v3/testsuite/util/testsuite_api.h
index 4dc4a6f..fcb762e 100644
--- a/libstdc++-v3/testsuite/util/testsuite_api.h
+++ b/libstdc++-v3/testsuite/util/testsuite_api.h
@@ -1,7 +1,7 @@
// -*- C++ -*-
// 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
// software; you can redistribute it and/or modify it under the
@@ -150,6 +150,30 @@ namespace __gnu_test
operator()() const
{ 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