aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers')
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/cons/55977.cc70
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/55979.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/1.h12
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/56613.cc74
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc1
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/55977.cc60
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
9 files changed, 254 insertions, 3 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/55977.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/55977.cc
new file mode 100644
index 00000000000..ef2d7c01c8d
--- /dev/null
+++ b/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/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc b/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc
new file mode 100644
index 00000000000..6a069bfd7e3
--- /dev/null
+++ b/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/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h
index 326df4b43ee..1e7767b4bee 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h
+++ b/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/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index 1fc5dfb47a5..63216cb01c8 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 *-*-* } 1525 }
+// { dg-error "no matching" "" { target *-*-* } 1529 }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/map/56613.cc b/libstdc++-v3/testsuite/23_containers/map/56613.cc
new file mode 100644
index 00000000000..98433598c6b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/56613.cc
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// 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 <testsuite_hooks.h>
+#include <map>
+
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+// libstdc++/56613
+#include <map>
+
+// A conforming C++03 allocator, should still work in C++11 mode.
+template<typename T>
+struct alloc
+{
+ typedef T value_type;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef unsigned size_type;
+ typedef int difference_type;
+
+ template<typename U>
+ struct rebind {
+ typedef alloc<U> other;
+ };
+
+ alloc() { }
+ template<typename U>
+ alloc(const alloc<U>&) { }
+
+ pointer allocate(size_type n, const void* = 0) { return
+std::allocator<T>().allocate(n); }
+ void deallocate(pointer p, size_type n) { std::allocator<T>().deallocate(p,
+n); }
+
+ size_type max_size() const { return -1; }
+
+ void construct(pointer p, const T& t) { new ((void*) p) T(t); }
+ void destroy(pointer p) { p->~T(); }
+
+ pointer address(reference x) const throw() { return &x; }
+ const_pointer address(const_reference x) const throw() { return &x; }
+};
+
+template<typename T, typename U>
+bool operator==(alloc<T>, alloc<U>) { return true; }
+
+template<typename T, typename U>
+bool operator!=(alloc<T>, alloc<U>) { return false; }
+
+int main()
+{
+ std::map<int, int, std::less<int>, alloc<int> > m;
+ m[1];
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc
index d44327f6c10..2de0308d18f 100644
--- a/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
+// { dg-additional-options "-static-libstdc++" { target *-*-mingw* } }
// { dg-require-cstdint "" }
// 2009-11-30 Benjamin Kosnik <benjamin@redhat.com>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/55977.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/55977.cc
new file mode 100644
index 00000000000..295d6b1d942
--- /dev/null
+++ b/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/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index aa7617365ea..64e46658bb8 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 *-*-* } 1236 }
+// { dg-error "no matching" "" { target *-*-* } 1240 }
#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 cc46be5805f..a8d98cb8092 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 *-*-* } 1277 }
+// { dg-error "no matching" "" { target *-*-* } 1281 }
#include <vector>