diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-02 21:47:37 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-02 21:47:37 +0000 |
commit | 6170dfb6edfb7b19f8ae5209b8f948fe0076a4ad (patch) | |
tree | 76b362fb924ab4ffb8a4b4610503ff684275f92b /libstdc++-v3 | |
parent | d11ae286bcc45264b87629485358d5642ab9301e (diff) | |
download | gcc-6170dfb6edfb7b19f8ae5209b8f948fe0076a4ad.tar.gz |
Merge trunk at revision 160193 into branch.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/vect256@160194 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
90 files changed, 1659 insertions, 253 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ae20b119cf4..a986e8d6325 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,190 @@ +2010-06-02 Jonathan Wakely <jwakely.gcc@gmail.com> + + * testsuite/tr1/2_general_utilities/shared_ptr/cons/pointer.cc: Fix + which tests are run. + * testsuite/20_util/shared_ptr/cons/pointer.cc: Likewise. + +2010-06-01 Maxim Kuvyrkov <maxim@codesourcery.com> + + * acinclude.m4, configure.host: Support Bionic C library. + * configure: Regenerate. + * config/os/bionic/ctype_base.h, config/os/bionic/ctype_inline.h, + * config/os/bionic/ctype_noincline.h, config/os/bionic/os_defines.h: + New files, based on config/os/newlib/*. + +2010-05-31 Jonathan Wakely <jwakely.gcc@gmail.com> + + PR libstdc++/43820 + * include/bits/shared_ptr_base.h: Require complete type. + * include/tr1/shared_ptr.h: Likewise. + * testsuite/20_util/shared_ptr/cons/43820.cc: New. + * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc: New. + +2010-05-31 Paolo Carlini <paolo.carlini@oracle.com> + + * include/bits/basic_string.h (front, back): Add. + * include/debug/string: Adjust. + * include/ext/vstring.h (front, back): Tweak the implementation + to follow more closely the letter of the specs. + * testsuite/21_strings/basic_string/element_access/char/ + front_back.cc: New. + * testsuite/21_strings/basic_string/element_access/wchar_t/ + front_back.cc: Likewise. + * config/abi/pre/gnu.ver: Export new symbols. + * testsuite/util/testsuite_abi.cc: Adjust. + * configure.ac: Bump minor version to 6:15:0. + * configure: Regenerate. + +2010-05-28 Paolo Carlini <paolo.carlini@oracle.com> + + * include/bits/stl_vector.h (vector<>::data): Fix return type + in c++0x mode. + * testsuite/23_containers/vector/requirements/dr438/ + assign_neg.cc: Adjust dg-error line number. + * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_2_neg.cc: Likewise. + +2010-05-27 Jason Merrill <jason@redhat.com> + + Revert: + PR libstdc++/42832 + * include/std/functional (function<>::swap): Perform bytewise + swap of _M_functor. + * include/tr1/functional (function<>::swap): Likewise. + +2010-05-27 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/40497 + * include/bits/cpp_type_traits.h (__is_iterator): Add. + * include/bits/stl_iterator_base_funcs.h (next, prev): Use it. + * testsuite/24_iterators/operations/40497.cc: New. + +2010-05-21 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/25306 + * include/bits/stl_algobase.h (fill_n): Use a properly typed __niter + initialized to __n. + * include/bits/stl_algo.h (generate_n): Likewise. + * testsuite/25_algorithms/fill_n/25306.cc: New. + * testsuite/25_algorithms/generate_n/25306.cc: Likewise. + +2010-05-21 Joseph Myers <joseph@codesourcery.com> + + * acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Use GNU locale model for + glibc 2.3 and later, but not uClibc, without an execution test. + * configure: Regenerate. + * doc/xml/manual/configure.xml, doc/xml/manual/prerequisites.xml, + doc/xml/faq.xml: Update. + +2010-05-21 Paolo Carlini <paolo.carlini@oracle.com> + + * include/tr1/functional: Use std::__addressof. + * include/tr1/hashtable_policy.h: Likewise. + +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. + * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-error + line number. + +2010-05-19 Jonathan Wakely <jwakely.gcc@gmail.com> + + * testsuite/30_threads/future/members/wait.cc (wait): Rename. + * testsuite/30_threads/shared_future/members/wait.cc (wait): Likewise. + +2010-05-18 Eelis van der Weegen <gcc-bugzilla@contacts.eelis.net> + + PR libstdc++/44190 + * include/debug/vector (vector<>::resize): Call + _M_update_guaranteed_capacity. + * testsuite/23_containers/vector/capacity/44190.cc: New. + +2010-05-17 Paolo Carlini <paolo.carlini@oracle.com> + + * include/std/functional (result_of): Move... + * include/std/type_traits: ... here. + * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error + line number. + 2010-05-12 Jason Merrill <jason@redhat.com> * testsuite/20_util/auto_ptr/assign_neg.cc: Expect template diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index f54517f200a..db6323d64ae 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -95,7 +95,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [ ## (Right now, this only matters for enable_wchar_t, but nothing prevents ## other macros from doing the same. This should be automated.) -pme - # Check for uClibc since Linux platforms use different configuration + # Check for C library flavor since Linux platforms use different configuration # directories depending on the C library in use. AC_EGREP_CPP([_using_uclibc], [ #include <stdio.h> @@ -104,6 +104,13 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [ #endif ], uclibc=yes, uclibc=no) + AC_EGREP_CPP([_using_bionic], [ + #include <stdio.h> + #if __BIONIC__ + _using_bionic + #endif + ], bionic=yes, bionic=no) + # Find platform-specific directories containing configuration info. # Also possibly modify flags used elsewhere, as needed by the platform. GLIBCXX_CHECK_HOST @@ -1740,41 +1747,11 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ if test $enable_clocale_flag = gnu; then AC_EGREP_CPP([_GLIBCXX_ok], [ #include <features.h> - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) + #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__) _GLIBCXX_ok #endif ], enable_clocale_flag=gnu, enable_clocale_flag=generic) - if test $enable_clocale = auto; then - # Test for bugs early in glibc-2.2.x series - AC_TRY_RUN([ - #define _GNU_SOURCE 1 - #include <locale.h> - #include <string.h> - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) - extern __typeof(newlocale) __newlocale; - extern __typeof(duplocale) __duplocale; - extern __typeof(strcoll_l) __strcoll_l; - #endif - int main() - { - const char __one[] = "Äuglein Augmen"; - const char __two[] = "Äuglein"; - int i; - int j; - __locale_t loc; - __locale_t loc_dup; - loc = __newlocale(1 << LC_ALL, "de_DE", 0); - loc_dup = __duplocale(loc); - i = __strcoll_l(__one, __two, loc); - j = __strcoll_l(__one, __two, loc_dup); - return 0; - } - ], - [enable_clocale_flag=gnu],[enable_clocale_flag=generic], - [enable_clocale_flag=generic]) - fi - # Set it to scream when it hurts. ac_save_CFLAGS="$CFLAGS" CFLAGS="-Wimplicit-function-declaration -Werror" diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 998b651d801..6375b88ff05 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -185,7 +185,10 @@ GLIBCXX_3.4 { # where it is used for size_type on LLP64 platforms. _ZNSsC[12][EI][PRjmvyN]*; _ZNSsD*; - _ZNSs[0-58-9][a-z]*; + _ZNSs[0-58-9]a*; + _ZNSs5beginEv; + _ZNSs[0-58-9][c-e]*; + _ZNSs[0-58-9][g-z]*; # _ZNSs[67][a-z]*E[PRcjmvy]*; _ZNSs6appendE[PRcjmvy]*; _ZNSs6assignE[PRcjmvy]*; @@ -219,9 +222,12 @@ GLIBCXX_3.4 { _ZNSsaSE[PRc]*; _ZNSsixE*; _ZNSspLE[PRc]*; - _ZNKSs[0-9][a-b]*; - _ZNKSs[0-9][d-z]*; + _ZNKSs[0-3][a-b]*; + _ZNKSs[5-9][a-b]*; + _ZNKSs[0-9][d-e]*; + _ZNKSs[0-9][g-z]*; _ZNKSs[0-9][0-9][a-z]*; + _ZNKSs4find*; _ZNKSs[a-z]*; _ZNKSs4_Rep12_M_is_leakedEv; _ZNKSs4_Rep12_M_is_sharedEv; @@ -240,7 +246,10 @@ GLIBCXX_3.4 { # std::wstring _ZNSbIwSt11char_traitsIwESaIwEEC[12][EI][PRjmvyN]*; _ZNSbIwSt11char_traitsIwESaIwEED*; - _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][a-z]*; + _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9]a*; + _ZNSbIwSt11char_traitsIwESaIwEE5beginEv; + _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][c-e]*; + _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][g-z]*; # _ZNSbIwSt11char_traitsIwESaIwEE[67][a-b]*E[PRwjmvy]*; _ZNSbIwSt11char_traitsIwESaIwEE6appendE[PRwjmvy]*; _ZNSbIwSt11char_traitsIwESaIwEE6assignE[PRwjmvy]*; @@ -274,10 +283,13 @@ GLIBCXX_3.4 { _ZNSbIwSt11char_traitsIwESaIwEEaSE[PRw]*; _ZNSbIwSt11char_traitsIwESaIwEEixE*; _ZNSbIwSt11char_traitsIwESaIwEEpLE[PRw]*; - _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][a-b]*; - _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][d-z]*; + _ZNKSbIwSt11char_traitsIwESaIwEE[0-3][a-b]*; + _ZNKSbIwSt11char_traitsIwESaIwEE[5-9][a-b]*; + _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][d-e]*; + _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][g-z]*; _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][0-9][a-z]*; _ZNKSbIwSt11char_traitsIwESaIwEE[a-z]*; + _ZNKSbIwSt11char_traitsIwESaIwEE4find*; _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_leakedEv; _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_sharedEv; _ZNKSbIwSt11char_traitsIwESaIwEE6_M_repEv; @@ -1150,6 +1162,19 @@ GLIBCXX_3.4.14 { } GLIBCXX_3.4.13; +GLIBCXX_3.4.15 { + + # string|wstring front and back member functions + _ZNSs5frontEv; + _ZNKSs5frontEv; + _ZNSbIwSt11char_traitsIwESaIwEE5frontEv; + _ZNKSbIwSt11char_traitsIwESaIwEE5frontEv; + _ZNSs4backEv; + _ZNKSs4backEv; + _ZNSbIwSt11char_traitsIwESaIwEE4backEv; + _ZNKSbIwSt11char_traitsIwESaIwEE4backEv; + +} GLIBCXX_3.4.14; # Symbols in the support library (libsupc++) have their own tag. CXXABI_1.3 { diff --git a/libstdc++-v3/config/os/bionic/ctype_base.h b/libstdc++-v3/config/os/bionic/ctype_base.h new file mode 100644 index 00000000000..15f00636d3e --- /dev/null +++ b/libstdc++-v3/config/os/bionic/ctype_base.h @@ -0,0 +1,57 @@ +// Locale support -*- C++ -*- + +// 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. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1 + +// Support for Solaris 2.5.1 + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /// @brief Base class for ctype. + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef char mask; + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _U | _L; + static const mask digit = _N; + static const mask xdigit = _X | _N; + static const mask space = _S; + static const mask print = _P | _U | _L | _N | _B; + static const mask graph = _P | _U | _L | _N; + static const mask cntrl = _C; + static const mask punct = _P; + static const mask alnum = _U | _L | _N; + }; + +_GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/config/os/bionic/ctype_inline.h b/libstdc++-v3/config/os/bionic/ctype_inline.h new file mode 100644 index 00000000000..2c88eb66d64 --- /dev/null +++ b/libstdc++-v3/config/os/bionic/ctype_inline.h @@ -0,0 +1,71 @@ +// Locale support -*- C++ -*- + +// 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. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file ctype_inline.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + +_GLIBCXX_BEGIN_NAMESPACE(std) + + bool + ctype<char>:: + is(mask __m, char __c) const + { return _M_table[static_cast<unsigned char>(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } + +_GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/config/os/bionic/ctype_noninline.h b/libstdc++-v3/config/os/bionic/ctype_noninline.h new file mode 100644 index 00000000000..55eecd8716e --- /dev/null +++ b/libstdc++-v3/config/os/bionic/ctype_noninline.h @@ -0,0 +1,98 @@ +// Locale support -*- C++ -*- + +// 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. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file ctype_noninline.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return _ctype_ + 1; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : facet(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { + memset(_M_widen, 0, sizeof(_M_widen)); + _M_widen_ok = 0; + memset(_M_narrow, 0, sizeof(_M_narrow)); + _M_narrow_ok = 0; + } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : facet(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { + memset(_M_widen, 0, sizeof(_M_widen)); + _M_widen_ok = 0; + memset(_M_narrow, 0, sizeof(_M_narrow)); + _M_narrow_ok = 0; + } + + char + ctype<char>::do_toupper(char __c) const + { + int __x = __c; + return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x); + } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_toupper(*__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { + int __x = __c; + return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x); + } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_tolower(*__low); + ++__low; + } + return __high; + } + diff --git a/libstdc++-v3/config/os/bionic/os_defines.h b/libstdc++-v3/config/os/bionic/os_defines.h new file mode 100644 index 00000000000..832592acd49 --- /dev/null +++ b/libstdc++-v3/config/os/bionic/os_defines.h @@ -0,0 +1,36 @@ +// Specific definitions for Bionic -*- C++ -*- + +// 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. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file os_defines.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + +#ifndef _GLIBCXX_OS_DEFINES +#define _GLIBCXX_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#endif diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index df45a861bf4..53f0ce3a7f0 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -2789,7 +2789,7 @@ ac_config_headers="$ac_config_headers config.h" ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=6:14:0 +libtool_VERSION=6:15:0 # Find the rest of the source tree framework. @@ -5186,7 +5186,7 @@ fi ## (Right now, this only matters for enable_wchar_t, but nothing prevents ## other macros from doing the same. This should be automated.) -pme - # Check for uClibc since Linux platforms use different configuration + # Check for C library flavor since Linux platforms use different configuration # directories depending on the C library in use. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5206,6 +5206,24 @@ fi rm -f conftest* + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <stdio.h> + #if __BIONIC__ + _using_bionic + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "_using_bionic" >/dev/null 2>&1; then : + bionic=yes +else + bionic=no +fi +rm -f conftest* + + # Find platform-specific directories containing configuration info. # Also possibly modify flags used elsewhere, as needed by the platform. @@ -11442,7 +11460,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11445 "configure" +#line 11463 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11548,7 +11566,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11551 "configure" +#line 11569 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14888,7 +14906,7 @@ fi # # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. cat > conftest.$ac_ext << EOF -#line 14891 "configure" +#line 14909 "configure" struct S { ~S(); }; void bar(); void foo() @@ -15256,7 +15274,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15259 "configure" +#line 15277 "configure" int main() { typedef bool atomic_type; @@ -15293,7 +15311,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15296 "configure" +#line 15314 "configure" int main() { typedef short atomic_type; @@ -15330,7 +15348,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15333 "configure" +#line 15351 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15368,7 +15386,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15371 "configure" +#line 15389 "configure" int main() { typedef long long atomic_type; @@ -15444,7 +15462,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15447 "configure" +#line 15465 "configure" int main() { _Decimal32 d1; @@ -15628,7 +15646,7 @@ fi /* end confdefs.h. */ #include <features.h> - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) + #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__) _GLIBCXX_ok #endif @@ -15642,49 +15660,6 @@ fi rm -f conftest* - if test $enable_clocale = auto; then - # Test for bugs early in glibc-2.2.x series - if test "$cross_compiling" = yes; then : - enable_clocale_flag=generic -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #define _GNU_SOURCE 1 - #include <locale.h> - #include <string.h> - #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) - extern __typeof(newlocale) __newlocale; - extern __typeof(duplocale) __duplocale; - extern __typeof(strcoll_l) __strcoll_l; - #endif - int main() - { - const char __one[] = "Äuglein Augmen"; - const char __two[] = "Äuglein"; - int i; - int j; - __locale_t loc; - __locale_t loc_dup; - loc = __newlocale(1 << LC_ALL, "de_DE", 0); - loc_dup = __duplocale(loc); - i = __strcoll_l(__one, __two, loc); - j = __strcoll_l(__one, __two, loc_dup); - return 0; - } - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - enable_clocale_flag=gnu -else - enable_clocale_flag=generic -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # Set it to scream when it hurts. ac_save_CFLAGS="$CFLAGS" CFLAGS="-Wimplicit-function-declaration -Werror" diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 7d7f7a95478..2d99a236440 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h) ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD # For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=6:14:0 +libtool_VERSION=6:15:0 AC_SUBST(libtool_VERSION) # Find the rest of the source tree framework. diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host index c1f2736667a..5cd2a217b6c 100644 --- a/libstdc++-v3/configure.host +++ b/libstdc++-v3/configure.host @@ -238,6 +238,8 @@ case "${host_os}" in gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) if [ "$uclibc" = "yes" ]; then os_include_dir="os/uclibc" + elif [ "$bionic" = "yes" ]; then + os_include_dir="os/bionic" else os_include_dir="os/gnu-linux" fi diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml index ad75d178470..57f08041789 100644 --- a/libstdc++-v3/doc/xml/faq.xml +++ b/libstdc++-v3/doc/xml/faq.xml @@ -640,6 +640,8 @@ 5.0.1) and later uses localization and formatting code from the system C library (glibc) version 2.2.5 which contains necessary bugfixes. Most GNU/Linux distros make more recent versions available now. + libstdc++ 4.6.0 and later require glibc 2.3 or later for this + localization and formatting code. </para> <para>The guideline is simple: the more recent the C++ library, the more recent the C library. (This is also documented in the main diff --git a/libstdc++-v3/doc/xml/manual/configure.xml b/libstdc++-v3/doc/xml/manual/configure.xml index 8cca56cd828..26af74582c9 100644 --- a/libstdc++-v3/doc/xml/manual/configure.xml +++ b/libstdc++-v3/doc/xml/manual/configure.xml @@ -113,8 +113,7 @@ <para>If not explicitly specified, the configure proccess tries to guess the most suitable package from the choices above. The default is 'generic'. On glibc-based systems of sufficient - vintage (2.2.5 and newer) and capability (with installed DE and - FR locale data), 'gnu' is automatically selected. This option + vintage (2.3 and newer), 'gnu' is automatically selected. This option can change the library ABI. </para> </listitem></varlistentry> diff --git a/libstdc++-v3/doc/xml/manual/prerequisites.xml b/libstdc++-v3/doc/xml/manual/prerequisites.xml index d7a162c056a..e85020f2563 100644 --- a/libstdc++-v3/doc/xml/manual/prerequisites.xml +++ b/libstdc++-v3/doc/xml/manual/prerequisites.xml @@ -58,16 +58,8 @@ <para> If gcc 3.1.0 or later on is being used on linux, an attempt will be made to use "C" library functionality necessary for - C++ named locale support. For gcc 3.2.1 and later, this - means that glibc 2.2.5 or later is required and the "C" - library de_DE locale information must be installed. - </para> - - <para> - Note however that the sanity checks involving the de_DE - locale are skipped when an explicit --enable-clocale=gnu - configure option is used: only the basic checks are carried - out, defending against misconfigurations. + C++ named locale support. For gcc 4.6.0 and later, this + means that glibc 2.3 or later is required. </para> <para> diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index d6d9989660e..fe9e1a3519c 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -851,6 +851,40 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return _M_data()[__n]; } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read/write reference to the data at the first + * element of the %string. + */ + reference + front() + { return operator[](0); } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %string. + */ + const_reference + front() const + { return operator[](0); } + + /** + * Returns a read/write reference to the data at the last + * element of the %string. + */ + reference + back() + { return operator[](this->size() - 1); } + + /** + * Returns a read-only (constant) reference to the data at the + * last element of the %string. + */ + const_reference + back() const + { return operator[](this->size() - 1); } +#endif + /** * @brief Provides access to the data contained in the %string. * @param n The index of the character to access. diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index 0d7b9ff09fc..8c5d8e9ca27 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -414,6 +414,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std) }; #endif + template<typename _Tp> + class __is_iterator_helper + { + typedef char __one; + typedef struct { char __arr[2]; } __two; + + template<typename _Up> + struct _Wrap_type + { }; + + template<typename _Up> + static __one __test(_Wrap_type<typename _Up::iterator_category>*); + + template<typename _Up> + static __two __test(...); + + public: + static const bool __value = (sizeof(__test<_Tp>(0)) == 1 + || __is_pointer<_Tp>::__value); + }; + + template<typename _Tp> + struct __is_iterator + { + enum { __value = __is_iterator_helper<_Tp>::__value }; + typedef typename __truth_type<__value>::__type __type; + }; + _GLIBCXX_END_NAMESPACE #endif //_CPP_TYPE_TRAITS_H diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index 57b7836a324..c0c135cd1b3 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 6e6a8fb0177..694d0ffdeb4 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 535923981a5..f1c4a10dd66 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 91754814d8b..a137f982bed 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/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 1999f36023b..0c366b8ef1a 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -97,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { delete this; } virtual void* - _M_get_deleter(const std::type_info& __ti) + _M_get_deleter(const std::type_info&) { return 0; } _Sp_counted_ptr(const _Sp_counted_ptr&) = delete; @@ -545,7 +545,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) explicit __shared_ptr(_Tp1* __p) : _M_ptr(__p), _M_refcount(__p) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - // __glibcxx_function_requires(_CompleteConcept<_Tp1*>) + static_assert( sizeof(_Tp1) > 0, "incomplete type" ); __enable_shared_from_this_helper(_M_refcount, __p, __p); } @@ -624,7 +624,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : _M_ptr(__r.get()), _M_refcount() { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - // TODO requires _Tp1 is complete, delete __r.release() well-formed + static_assert( sizeof(_Tp1) > 0, "incomplete type" ); _Tp1* __tmp = __r.get(); _M_refcount = __shared_count<_Lp>(std::move(__r)); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 5b4991e33b6..fe2edb9c8da 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -4844,7 +4844,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P) // "the type returned by a _Generator" __typeof__(__gen())>) - for (; __n > 0; --__n, ++__first) + for (__decltype(__n + 0) __niter = __n; + __niter > 0; --__niter, ++__first) *__first = __gen(); return __first; } diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index e92540431de..0489c413b95 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -748,7 +748,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) { - for (; __n > 0; --__n, ++__first) + for (__decltype(__n + 0) __niter = __n; + __niter > 0; --__niter, ++__first) *__first = __value; return __first; } @@ -759,7 +760,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) { const _Tp __tmp = __value; - for (; __n > 0; --__n, ++__first) + for (__decltype(__n + 0) __niter = __n; + __niter > 0; --__niter, ++__first) *__first = __tmp; return __first; } diff --git a/libstdc++-v3/include/bits/stl_construct.h b/libstdc++-v3/include/bits/stl_construct.h index 3c30b9a4504..06a2902ca69 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_iterator_base_funcs.h b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h index 627fbe917ee..50e0bca83e2 100644 --- a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h +++ b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h @@ -61,6 +61,7 @@ #define _STL_ITERATOR_BASE_FUNCS_H 1 #pragma GCC system_header + #include <bits/concept_check.h> _GLIBCXX_BEGIN_NAMESPACE(std) @@ -172,9 +173,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std) std::__advance(__i, __d, std::__iterator_category(__i)); } +_GLIBCXX_END_NAMESPACE + #ifdef __GXX_EXPERIMENTAL_CXX0X__ + +#include <ext/type_traits.h> // For __enable_if and __is_iterator + +_GLIBCXX_BEGIN_NAMESPACE(std) + template<typename _ForwardIterator> - inline _ForwardIterator + inline typename + __gnu_cxx::__enable_if<__is_iterator<_ForwardIterator>::__value, + _ForwardIterator>::__type next(_ForwardIterator __x, typename iterator_traits<_ForwardIterator>::difference_type __n = 1) { @@ -183,15 +193,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template<typename _BidirectionalIterator> - inline _BidirectionalIterator + inline typename + __gnu_cxx::__enable_if<__is_iterator<_BidirectionalIterator>::__value, + _BidirectionalIterator>::__type prev(_BidirectionalIterator __x, typename iterator_traits<_BidirectionalIterator>::difference_type __n = 1) { std::advance(__x, -__n); return __x; } -#endif _GLIBCXX_END_NAMESPACE +#endif // __GXX_EXPERIMENTAL_CXX0X__ + #endif /* _STL_ITERATOR_BASE_FUNCS_H */ diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 5fcbc4f3470..56357ed07da 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_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 0618026f4d6..6c2b51e4c6b 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -98,6 +98,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : first(__a), second(__b) { } #ifdef __GXX_EXPERIMENTAL_CXX0X__ + pair(const pair&) = default; + // DR 811. template<class _U1, class = typename std::enable_if<std::is_convertible<_U1, _T1>::value>::type> @@ -152,6 +154,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<class _U1, class _U2> pair& + operator=(const pair<_U1, _U2>& __p) + { + first = __p.first; + second = __p.second; + return *this; + } + + template<class _U1, class _U2> + pair& operator=(pair<_U1, _U2>&& __p) { first = std::move(__p.first); diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index d37dc57246e..58c63cf4376 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 4b6399d9961..b78f92025c3 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/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 96fc86c5dc9..f025b4eeb45 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -718,13 +718,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) * Returns a pointer such that [data(), data() + size()) is a valid * range. For a non-empty %vector, data() == &front(). */ +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + _Tp* +#else pointer +#endif data() - { return pointer(this->_M_impl._M_start); } + { return std::__addressof(front()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const _Tp* +#else const_pointer +#endif data() const - { return const_pointer(this->_M_impl._M_start); } + { return std::__addressof(front()); } // [23.2.4.3] modifiers /** diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string index 160488e989b..fe31ffb99ed 100644 --- a/libstdc++-v3/include/debug/string +++ b/libstdc++-v3/include/debug/string @@ -262,6 +262,11 @@ namespace __gnu_debug using _Base::at; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + using _Base::front; + using _Base::back; +#endif + // 21.3.5 modifiers: basic_string& operator+=(const basic_string& __str) diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index c360197fe8c..ea55b080442 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -235,6 +235,7 @@ namespace __debug _Base::resize(__sz, __c); if (__realloc) this->_M_invalidate_all(); + _M_update_guaranteed_capacity(); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h index f36f273d1fe..36f15fe936c 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 d91d9aa5cc6..05285f548cc 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 fab6b1d85ed..d9e8cda440d 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 b432c63a61e..ed3c3b2b0ac 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 0e675133296..8fdb2f6393b 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 51666c3c7fd..beaddddf9ee 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 b1e61841c0a..66cda84b42d 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 48089bd7dd0..70b197a705d 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/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index fc469cbdc04..dffd35a19e3 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -62,8 +62,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) typedef _Alloc allocator_type; typedef typename _CharT_alloc_type::size_type size_type; typedef typename _CharT_alloc_type::difference_type difference_type; - typedef typename _CharT_alloc_type::reference reference; - typedef typename _CharT_alloc_type::const_reference const_reference; + typedef value_type& reference; + typedef const value_type& const_reference; typedef typename _CharT_alloc_type::pointer pointer; typedef typename _CharT_alloc_type::const_pointer const_pointer; typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator; @@ -598,7 +598,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ reference front() - { return *begin(); } + { return operator[](0); } /** * Returns a read-only (constant) reference to the data at the first @@ -606,7 +606,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ const_reference front() const - { return *begin(); } + { return operator[](0); } /** * Returns a read/write reference to the data at the last @@ -614,7 +614,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ reference back() - { return *(end() - 1); } + { return operator[](this->size() - 1); } /** * Returns a read-only (constant) reference to the data at the @@ -622,7 +622,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ const_reference back() const - { return *(end() - 1); } + { return operator[](this->size() - 1); } #endif // Modifiers: diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 00b94940f24..b6cc6d5e072 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -169,17 +169,6 @@ namespace std : _Weak_result_type_impl<typename remove_cv<_Functor>::type> { }; - template<typename _Signature> - class result_of; - - template<typename _Functor, typename... _ArgTypes> - struct result_of<_Functor(_ArgTypes...)> - { - typedef - decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) ) - type; - }; - /// Determines if the type _Tp derives from unary_function. template<typename _Tp> struct _Derives_from_unary_function : __sfinae_types @@ -401,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; @@ -1958,16 +1948,9 @@ namespace std */ void swap(function& __x) { - /* We cannot perform direct assignments of the _M_functor - parts as they are of type _Any_data and have a different - dynamic type. Doing so would violate type-based aliasing - rules and lead to spurious miscompilations. - Instead perform a bytewise exchange of the memory of - both POD objects. - ??? A wordwise exchange honoring alignment of _M_functor - would be more efficient. See PR42845. */ - for (unsigned i = 0; i < sizeof (_M_functor._M_pod_data); ++i) - std::swap (_M_functor._M_pod_data[i], __x._M_functor._M_pod_data[i]); + _Any_data __old_functor = _M_functor; + _M_functor = __x._M_functor; + __x._M_functor = __old_functor; _Manager_type __old_manager = _M_manager; _M_manager = __x._M_manager; __x._M_manager = __old_manager; diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index a2748c565b1..9831851c4a5 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -638,7 +638,6 @@ namespace std typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; }; - // @} group metaprogramming /// declval template<typename _Tp> @@ -656,6 +655,20 @@ namespace std "declval() must not be used!"); return __declval_protector<_Tp>::__delegate(); } + + /// result_of + template<typename _Signature> + class result_of; + + template<typename _Functor, typename... _ArgTypes> + struct result_of<_Functor(_ArgTypes...)> + { + typedef + decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) ) + type; + }; + + // @} group metaprogramming } #endif // __GXX_EXPERIMENTAL_CXX0X__ diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional index 7bc0d5e5f75..3340de6fffc 100644 --- a/libstdc++-v3/include/tr1/functional +++ b/libstdc++-v3/include/tr1/functional @@ -42,6 +42,7 @@ #include <bits/stringfwd.h> #include <tr1/functional_hash.h> #include <ext/type_traits.h> +#include <bits/move.h> // for std::__addressof namespace std { @@ -452,7 +453,8 @@ namespace tr1 typedef _Tp type; explicit - reference_wrapper(_Tp& __indata): _M_data(&__indata) + reference_wrapper(_Tp& __indata) + : _M_data(std::__addressof(__indata)) { } reference_wrapper(const reference_wrapper<_Tp>& __inref): @@ -1905,16 +1907,9 @@ namespace tr1 */ void swap(function& __x) { - /* We cannot perform direct assignments of the _M_functor - parts as they are of type _Any_data and have a different - dynamic type. Doing so would violate type-based aliasing - rules and lead to spurious miscompilations. - Instead perform a bytewise exchange of the memory of - both POD objects. - ??? A wordwise exchange honoring alignment of _M_functor - would be more efficient. See PR42845. */ - for (unsigned i = 0; i < sizeof (_M_functor._M_pod_data); ++i) - std::swap (_M_functor._M_pod_data[i], __x._M_functor._M_pod_data[i]); + _Any_data __old_functor = _M_functor; + _M_functor = __x._M_functor; + __x._M_functor = __old_functor; _Manager_type __old_manager = _M_manager; _M_manager = __x._M_manager; __x._M_manager = __old_manager; diff --git a/libstdc++-v3/include/tr1/hashtable_policy.h b/libstdc++-v3/include/tr1/hashtable_policy.h index 2a0e0ed4e1a..514fdb0983e 100644 --- a/libstdc++-v3/include/tr1/hashtable_policy.h +++ b/libstdc++-v3/include/tr1/hashtable_policy.h @@ -136,7 +136,7 @@ namespace __detail pointer operator->() const - { return &this->_M_cur->_M_v; } + { return std::__addressof(this->_M_cur->_M_v); } _Node_iterator& operator++() @@ -181,7 +181,7 @@ namespace __detail pointer operator->() const - { return &this->_M_cur->_M_v; } + { return std::__addressof(this->_M_cur->_M_v); } _Node_const_iterator& operator++() @@ -281,7 +281,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++() @@ -331,7 +331,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/tr1/shared_ptr.h b/libstdc++-v3/include/tr1/shared_ptr.h index 6176b5e4814..f504e083c52 100644 --- a/libstdc++-v3/include/tr1/shared_ptr.h +++ b/libstdc++-v3/include/tr1/shared_ptr.h @@ -1,6 +1,6 @@ // <tr1/shared_ptr.h> -*- 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 @@ -367,7 +367,7 @@ namespace tr1 : _M_ptr(__p), _M_refcount(__p) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - // __glibcxx_function_requires(_CompleteConcept<_Tp1*>) + typedef int _IsComplete[sizeof(_Tp1)]; __enable_shared_from_this_helper(_M_refcount, __p, __p); } @@ -404,9 +404,9 @@ namespace tr1 explicit __shared_ptr(std::auto_ptr<_Tp1>& __r) : _M_ptr(__r.get()), _M_refcount() - { + { // TODO requries delete __r.release() well-formed __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - // TODO requires _Tp1 is complete, delete __r.release() well-formed + typedef int _IsComplete[sizeof(_Tp1)]; _Tp1* __tmp = __r.get(); _M_refcount = __shared_count<_Lp>(__r); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); diff --git a/libstdc++-v3/include/tr1_impl/array b/libstdc++-v3/include/tr1_impl/array index edc4aec90b4..db0364e5357 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 00000000000..43009f3c833 --- /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 00000000000..559cd20e2fe --- /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/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index bd424788dfb..c3b5022f77a 100644 --- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 655 } +// { dg-error "static assertion failed" "" { target *-*-* } 654 } // { dg-error "instantiated from here" "" { target *-*-* } 30 } // { dg-excess-errors "In function" } 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 00000000000..b167d71224b --- /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/20_util/shared_ptr/cons/43820.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc new file mode 100644 index 00000000000..63500799838 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 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 +// 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/>. + +// 20.9.11.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> + +// incomplete type +struct X; + +// get an auto_ptr rvalue +std::auto_ptr<X>&& ap(); + +void test01() +{ + X* px = 0; + std::shared_ptr<X> p1(px); // { dg-error "here" } + // { dg-error "incomplete" "" { target *-*-* } 549 } + + std::shared_ptr<X> p9(ap()); // { dg-error "here" } + // { dg-error "incomplete" "" { target *-*-* } 630 } + +} + +// { dg-excess-errors "" } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/pointer.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/pointer.cc index 4bb528011a6..701f1243922 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/pointer.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/pointer.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation +// Copyright (C) 2005, 2006, 2007, 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 @@ -75,6 +75,6 @@ main() { test01(); test02(); - test02(); + test03(); return 0; } diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc index 6165db09df7..cbe5f9fdbe8 100644 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc @@ -48,4 +48,4 @@ main() // { dg-warning "note" "" { target *-*-* } 1005 } // { dg-warning "note" "" { target *-*-* } 340 } // { dg-warning "note" "" { target *-*-* } 290 } -// { dg-warning "note" "" { target *-*-* } 190 } +// { dg-warning "note" "" { target *-*-* } 201 } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/front_back.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/front_back.cc new file mode 100644 index 00000000000..a7c1386ae9d --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/front_back.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +// 2010-05-31 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 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 +// 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 <string> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::string str("ramifications"); + const std::string cstr("melodien"); + + VERIFY( str.front() == 'r' ); + VERIFY( str.back() == 's' ); + VERIFY( cstr.front() == 'm' ); + VERIFY( cstr.back() == 'n' ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/front_back.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/front_back.cc new file mode 100644 index 00000000000..60b09606fe1 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/front_back.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +// 2010-05-31 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 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 +// 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 <string> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::wstring str(L"ramifications"); + const std::wstring cstr(L"melodien"); + + VERIFY( str.front() == L'r' ); + VERIFY( str.back() == L's' ); + VERIFY( cstr.front() == L'm' ); + VERIFY( cstr.back() == L'n' ); +} + +int main() +{ + test01(); + return 0; +} 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 00000000000..9bd5bc9c065 --- /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 00000000000..4685ae14299 --- /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 8d72db59c8b..1625e3bc76b 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 5f5ac2c7713..5acfcd1f47f 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 340a6be65e3..dcf69089b00 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 1173dc1b697..22574fd081a 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 00000000000..11f15248f1a --- /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 d41e1498069..eb35a24c89d 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 01d9135c860..937404b26a8 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 c13f6565df4..74fc1b7a163 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 262a7a15f94..3aebda5ddb2 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 00000000000..7ad82a365c0 --- /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 00000000000..2a3700adde8 --- /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 00000000000..82bd4cda87b --- /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 00000000000..d55064cd1d3 --- /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 00000000000..2bbe9766722 --- /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 00000000000..37b57b3717a --- /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 00000000000..d92fdc5b3bc --- /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 00000000000..618402643fa --- /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 00000000000..3f619b71cd6 --- /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/capacity/44190.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc new file mode 100644 index 00000000000..737108b49d6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc @@ -0,0 +1,38 @@ +// 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/>. + +// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" } + +#include <vector> +#include <testsuite_hooks.h> + +// libstdc++/44190 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<int> v; + v.resize(10); + VERIFY( v.size() <= v.capacity() ); +} + +int main() +{ + + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index f0fae0083ba..b96b5359963 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1055 } +// { dg-error "no matching" "" { target *-*-* } 1063 } // { dg-excess-errors "" } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index ea0acfb5a91..950643857c5 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 995 } +// { dg-error "no matching" "" { target *-*-* } 1003 } // { dg-excess-errors "" } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index 67dd1f33e11..f17b541a4e0 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 995 } +// { dg-error "no matching" "" { target *-*-* } 1003 } // { dg-excess-errors "" } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index 9eb0ab15acf..19d3fd08c4b 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1096 } +// { dg-error "no matching" "" { target *-*-* } 1104 } // { dg-excess-errors "" } #include <vector> 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 00000000000..9305e3c87c5 --- /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/24_iterators/operations/40497.cc b/libstdc++-v3/testsuite/24_iterators/operations/40497.cc new file mode 100644 index 00000000000..59a64fbb099 --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/operations/40497.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 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/>. + +namespace X +{ + class C { }; + + template<class T> void next(T) { } + template<class T> void prev(T) { } +} + +using namespace X; + +#include <iterator> + +using namespace std; + +// libstdc++/40497 +void test01() +{ + C c; + next(c); + prev(c); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/fill_n/25306.cc b/libstdc++-v3/testsuite/25_algorithms/fill_n/25306.cc new file mode 100644 index 00000000000..37ccd7c36e8 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/fill_n/25306.cc @@ -0,0 +1,30 @@ +// { dg-do compile } + +// 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 <algorithm> + +struct Size +{ + operator int() { return 0; } +private: + void operator=(Size&); +}; + +// libstdc++/25306 +template int* std::fill_n(int*, Size, const int&); diff --git a/libstdc++-v3/testsuite/25_algorithms/generate_n/25306.cc b/libstdc++-v3/testsuite/25_algorithms/generate_n/25306.cc new file mode 100644 index 00000000000..f73ff3d778e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/generate_n/25306.cc @@ -0,0 +1,30 @@ +// { dg-do compile } + +// 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 <algorithm> + +struct Size +{ + operator int() { return 0; } +private: + void operator=(Size&); +}; + +// libstdc++/25306 +template int* std::generate_n(int*, Size, int (*)()); diff --git a/libstdc++-v3/testsuite/30_threads/future/members/wait.cc b/libstdc++-v3/testsuite/30_threads/future/members/wait.cc index 94a431f8183..d1b44dbffc6 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/wait.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/wait.cc @@ -31,7 +31,7 @@ #include <testsuite_hooks.h> -void wait(std::future<void>& f) +void fut_wait(std::future<void>& f) { f.wait(); } @@ -41,7 +41,7 @@ void test01() std::promise<void> p1; std::future<void> f1(p1.get_future()); - std::thread t1(wait, std::ref(f1)); + std::thread t1(fut_wait, std::ref(f1)); p1.set_value(); t1.join(); diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc index a4e325b0d96..e690878b48d 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc @@ -29,7 +29,7 @@ #include <mutex> #include <testsuite_hooks.h> -void wait(std::shared_future<void> f) +void fut_wait(std::shared_future<void> f) { f.wait(); } @@ -39,9 +39,9 @@ void test01() std::promise<void> p1; std::shared_future<void> f1(p1.get_future()); - std::thread t1(wait, f1); - std::thread t2(wait, f1); - std::thread t3(wait, f1); + std::thread t1(fut_wait, f1); + std::thread t2(fut_wait, f1); + std::thread t3(fut_wait, f1); p1.set_value(); t1.join(); diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc new file mode 100644 index 00000000000..b5fe3567f9a --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc @@ -0,0 +1,40 @@ +// { dg-do compile } + +// Copyright (C) 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 +// 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/>. + +// 2.2.3 Class template shared_ptr [tr.util.smartptr.shared] + +#include <tr1/memory> + +// incomplete type +struct X; + +std::auto_ptr<X>& ap(); + +void test01() +{ + X* px = 0; + std::tr1::shared_ptr<X> p1(px); // { dg-error "here" } + // { dg-error "incomplete" "" { target *-*-* } 370 } + + std::tr1::shared_ptr<X> p9(ap()); // { dg-error "here" } + // { dg-error "incomplete" "" { target *-*-* } 409 } + +} + +// { dg-excess-errors "" } diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/pointer.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/pointer.cc index 54e19ab7382..72f89b5b683 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/pointer.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/pointer.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2005, 2009 Free Software Foundation +// Copyright (C) 2005, 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 @@ -73,6 +73,6 @@ main() { test01(); test02(); - test02(); + test03(); return 0; } diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc index c7166c69917..d3c73f662b0 100644 --- a/libstdc++-v3/testsuite/util/testsuite_abi.cc +++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc @@ -1,6 +1,7 @@ // -*- C++ -*- -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +// Free Software Foundation, Inc. // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -186,6 +187,7 @@ check_version(symbol& test, bool added) known_versions.push_back("GLIBCXX_3.4.12"); known_versions.push_back("GLIBCXX_3.4.13"); known_versions.push_back("GLIBCXX_3.4.14"); + known_versions.push_back("GLIBCXX_3.4.15"); known_versions.push_back("GLIBCXX_LDBL_3.4"); known_versions.push_back("GLIBCXX_LDBL_3.4.7"); known_versions.push_back("GLIBCXX_LDBL_3.4.10"); diff --git a/libstdc++-v3/testsuite/util/testsuite_api.h b/libstdc++-v3/testsuite/util/testsuite_api.h index 4dc4a6fb7bb..fcb762eff66 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 |