diff options
author | Ben Cheng <bccheng@google.com> | 2013-08-05 15:18:29 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2013-08-05 16:03:48 -0700 |
commit | 32fce3edda831e36ee484406c39dffbe0230f257 (patch) | |
tree | 733b1b5398304b260a4ee3d5d9b17da5038c5486 /gcc-4.8/libstdc++-v3/testsuite/23_containers | |
parent | e85b9ca2afe8edbb9fa99c6ce2cc4e52dce18c21 (diff) | |
download | toolchain_gcc-32fce3edda831e36ee484406c39dffbe0230f257.tar.gz toolchain_gcc-32fce3edda831e36ee484406c39dffbe0230f257.tar.bz2 toolchain_gcc-32fce3edda831e36ee484406c39dffbe0230f257.zip |
[4.8] Merge GCC 4.8.1
Change-Id: Ic8a60b7563f5172440fd40788605163a0cca6e30
Diffstat (limited to 'gcc-4.8/libstdc++-v3/testsuite/23_containers')
9 files changed, 231 insertions, 4 deletions
diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc index 3e5ec1edb..76ea230b1 100644 --- a/gcc-4.8/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc +++ b/gcc-4.8/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc @@ -23,4 +23,4 @@ typedef std::tuple_element<1, std::array<int, 1>>::type type; -// { dg-error "static assertion failed" "" { target *-*-* } 306 } +// { dg-error "static assertion failed" "" { target *-*-* } 300 } diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/deque/cons/55977.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/deque/cons/55977.cc new file mode 100644 index 000000000..ef2d7c01c --- /dev/null +++ b/gcc-4.8/libstdc++-v3/testsuite/23_containers/deque/cons/55977.cc @@ -0,0 +1,70 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 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 <utility> +#include <deque> +#include <iterator> + +template <class T> +struct MyAllocator +{ + std::allocator<T> base; + typedef T value_type; + + // FIXME: these types shouldn't be required. + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + template <typename U> + struct rebind + { typedef MyAllocator<U> other; }; + + MyAllocator() = default; + template <class U> + MyAllocator(const MyAllocator<U>& other) : base(other.base) {} + T* allocate(std::size_t n) { return base.allocate(n); } + void deallocate(T* p, std::size_t n) { return base.deallocate(p, n); } + template <class U, class... Args> + void construct(U* p, Args&&... args) + { + ::new (static_cast<void*>(p)) U(std::forward<Args>(args)...); + } +}; + +struct A +{ +private: + friend class MyAllocator<A>; + A(int value) : value(value) {} + int value; +public: + A() : value() {} + int get() const { return value; } +}; + +void foo() +{ + std::deque<A, MyAllocator<A>> v1; + const int i = 1; + v1.emplace_back(i); // OK + std::deque<A, MyAllocator<A>> v2(std::istream_iterator<int>(), {}); // ERROR +} diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc new file mode 100644 index 000000000..6a069bfd7 --- /dev/null +++ b/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc @@ -0,0 +1,34 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 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 <list> + +struct A +{ + A(int) { } + A(const A&) = delete; + A& operator=(const A&) = delete; +}; + +void foo() +{ + int i[] = {1, 2}; + std::list<A> li(i, i + 2); +} diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h b/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h index 326df4b43..1e7767b4b 100644 --- a/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h +++ b/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h @@ -89,14 +89,22 @@ modifiers1() b = list0301.begin(); list0301.insert(b, A, A + N); // should be [321 322 333 13 13] VERIFY(list0301.size() == 5); +#if __cplusplus >= 201103L + VERIFY(copy_constructor::count() == 0); +#else VERIFY(copy_constructor::count() == 3); +#endif VERIFY(m->id() == 13); // range fill at end value_type::reset(); list0301.insert(e, A, A + N); // should be [321 322 333 13 13 321 322 333] VERIFY(list0301.size() == 8); +#if __cplusplus >= 201103L + VERIFY(copy_constructor::count() == 0); +#else VERIFY(copy_constructor::count() == 3); +#endif VERIFY(e == list0301.end()); VERIFY(m->id() == 13); @@ -104,7 +112,11 @@ modifiers1() value_type::reset(); list0301.insert(m, A, A + N); VERIFY(list0301.size() == 11); +#if __cplusplus >= 201103L + VERIFY(copy_constructor::count() == 0); +#else VERIFY(copy_constructor::count() == 3); +#endif VERIFY(e == list0301.end()); VERIFY(m->id() == 13); diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc index 1fc5dfb47..63216cb01 100644 --- a/gcc-4.8/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc +++ b/gcc-4.8/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 *-*-* } 1525 } +// { dg-error "no matching" "" { target *-*-* } 1529 } #include <list> diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/unordered_set/insert/move_range.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/unordered_set/insert/move_range.cc new file mode 100644 index 000000000..cb396eccc --- /dev/null +++ b/gcc-4.8/libstdc++-v3/testsuite/23_containers/unordered_set/insert/move_range.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 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/>. + +// range insert using move iterator + +#include <iterator> +#include <vector> +#include <unordered_set> +#include <testsuite_hooks.h> +#include <testsuite_counter_type.h> + +bool test __attribute__((unused)) = true; + +void test01() +{ + using namespace __gnu_test; + + std::vector<counter_type> ref = { 0, 1, 2, 3, 4, 5 }; + typedef std::unordered_set<counter_type, counter_type_hasher> Set; + Set s; + + counter_type::reset(); + + s.insert(std::make_move_iterator(ref.begin()), + std::make_move_iterator(ref.end())); + + VERIFY( s.size() == ref.size() ); + VERIFY( counter_type::move_count == ref.size() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/cons/55977.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/cons/55977.cc new file mode 100644 index 000000000..295d6b1d9 --- /dev/null +++ b/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/cons/55977.cc @@ -0,0 +1,60 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 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 <utility> +#include <vector> +#include <iterator> + +template <class T> +struct MyAllocator +{ + std::allocator<T> base; + typedef T value_type; + MyAllocator() = default; + template <class U> + MyAllocator(const MyAllocator<U>& other) : base(other.base) {} + T* allocate(std::size_t n) { return base.allocate(n); } + void deallocate(T* p, std::size_t n) { return base.deallocate(p, n); } + template <class U, class... Args> + void construct(U* p, Args&&... args) + { + ::new (static_cast<void*>(p)) U(std::forward<Args>(args)...); + } +}; + +struct A +{ +private: + friend class MyAllocator<A>; + A(int value) : value(value) {} + int value; +public: + A() : value() {} + int get() const { return value; } +}; + +void foo() +{ + std::vector<A, MyAllocator<A>> v1; + const int i = 1; + v1.emplace_back(i); // OK + std::vector<A, MyAllocator<A>> v2(std::istream_iterator<int>(), {}); // ERROR +} diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index aa7617365..64e46658b 100644 --- a/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/gcc-4.8/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 *-*-* } 1236 } +// { dg-error "no matching" "" { target *-*-* } 1240 } #include <vector> diff --git a/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index cc46be580..a8d98cb80 100644 --- a/gcc-4.8/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/gcc-4.8/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 *-*-* } 1277 } +// { dg-error "no matching" "" { target *-*-* } 1281 } #include <vector> |