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.
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++()
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++()
pointer
operator->() const
- { return &this->_M_cur->_M_v; }
+ { return std::__addressof(this->_M_cur->_M_v); }
_Node_iterator&
operator++()
pointer
operator->() const
- { return &this->_M_cur->_M_v; }
+ { return std::__addressof(this->_M_cur->_M_v); }
_Node_const_iterator&
operator++()
pointer
operator->() const
- { return &this->_M_cur_node->_M_v; }
+ { return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_iterator&
operator++()
pointer
operator->() const
- { return &this->_M_cur_node->_M_v; }
+ { return std::__addressof(this->_M_cur_node->_M_v); }
_Hashtable_const_iterator&
operator++()
#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);
}
// _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;
// 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
#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.
/// 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)
// 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
__destroy(_ForwardIterator __first, _ForwardIterator __last)
{
for (; __first != __last; ++__first)
- std::_Destroy(&*__first);
+ std::_Destroy(std::__addressof(*__first));
}
};
_Allocator& __alloc)
{
for (; __first != __last; ++__first)
- __alloc.destroy(&*__first);
+ __alloc.destroy(std::__addressof(*__first));
}
template<typename _ForwardIterator, typename _Tp>
_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++()
pointer
operator->() const
- { return &static_cast<_Node*>(_M_node)->_M_data; }
+ { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self&
operator++()
_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(...)
{
#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);
}
// 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
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++()
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++()
{
_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);
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
// 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
__try
{
for (; __first != __last; ++__first, ++__cur)
- std::_Construct(&*__cur, *__first);
+ std::_Construct(std::__addressof(*__cur), *__first);
return __cur;
}
__catch(...)
__try
{
for (; __cur != __last; ++__cur)
- std::_Construct(&*__cur, __x);
+ std::_Construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
_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(...)
__try
{
for (; __n > 0; --__n, ++__cur)
- std::_Construct(&*__cur, __x);
+ std::_Construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
__try
{
for (; __first != __last; ++__first, ++__cur)
- __alloc.construct(&*__cur, *__first);
+ __alloc.construct(std::__addressof(*__cur), *__first);
return __cur;
}
__catch(...)
__try
{
for (; __cur != __last; ++__cur)
- __alloc.construct(&*__cur, __x);
+ __alloc.construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
__try
{
for (; __n > 0; --__n, ++__cur)
- __alloc.construct(&*__cur, __x);
+ __alloc.construct(std::__addressof(*__cur), __x);
}
__catch(...)
{
__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;
}
// 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
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)
// 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
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()
// <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
{ }
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); }
// 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
~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.
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()
// 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
~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.
// 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
~__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()
{ 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())
public:
typedef _Tp type;
- reference_wrapper(_Tp& __indata): _M_data(&__indata)
+ reference_wrapper(_Tp& __indata)
+ : _M_data(std::__addressof(__indata))
{ }
reference_wrapper(_Tp&&) = delete;
// 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()
#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
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.
--- /dev/null
+// { 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;
+}
--- /dev/null
+// { 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&);
+}
--- /dev/null
+// { 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);
+}
--- /dev/null
+// { 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>;
--- /dev/null
+// 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-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
// { 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
// { 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
// { 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
--- /dev/null
+// { 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>;
// <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>
// 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
// <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>
// <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>
// <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>
--- /dev/null
+// 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>;
--- /dev/null
+// 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>;
--- /dev/null
+// 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>;
--- /dev/null
+// 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>;
--- /dev/null
+// 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>;
--- /dev/null
+// { 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>;
--- /dev/null
+// { 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>;
--- /dev/null
+// { 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>;
--- /dev/null
+// { 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>;
--- /dev/null
+// 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++ -*-
// 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
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